Napi patch: Nodereferrer create Organic Groups kompatibilitás

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.
Kategória: 
patch

A Nodereferrer Create egy okos kis modul, ami annyit csinál, hogyha van egy node, amiben egy node_reference mezőben már meglévő tartalomra tudunk hivatkozni, akkor miért is ne lehetne ugyanarról a node-ról azokat a tartalmakat létrehozni?

Lássuk konkrétan a feladatot:

Van egy tartalomtípusom, project. Ehhez node_reference-szel hozzá tudok adni password_record nevű tartalomtípusokat. Eddig semmi gond, a nodereferrer_create modul kipakolja a szükséges linkeket a project node-hoz, amit azon keresztül adok hozzá, az egyből be is lesz kapcsolva a project node-ba.

Nálam bonyolította a helyzetet, hogy organic_groups-t is használok. Vagyis szeretném, ha az így bekapcsolt password_record node-ok egyből abba a csoportba kerüljenek, amelybe maga a project van.
Ezt azonban nem kezeli a modul.

Ilyen linket ad alapból: node/%/create_reference/0/password_record
És nekünk ez kell: node/%/create_reference/0/password_record?gids[]=%

Nézzük akkor a forráskódot, illetve nem másolom be az egészet, van még egy pár feltétel, amit megvizsgál, de az alapelv ugyanaz.

[geshifilter-drupal6]** /** * hook_nodeapi view for reference fields * * Add the forms/fields */ function _nodereferrer_create_nodeapi_view_reference(&$node, $teaser, $page) { $menu_items = array(); foreach($node->reference_fields as $i => $ref) { $multiple = $ref['multiple'] == 1; $items = array(); foreach (array_filter($ref['referenceable_types']) as $referenceable_type) { $type_info = content_types($referenceable_type); if ($multiple) { if (node_access('create', $referenceable_type)) { $text = t(variable_get('nodereferrer_create_reference_label', 'Create new @type'), array('@type' => $type_info['name'])); $url = 'node/'.$node->nid.'/create_reference/'.$i.'/'.$referenceable_type; // és most jön a lényeg: ez a sor állítja elő a linket, amivel a kapcsolódó tartalmat létrehozhatjuk: $items[] = l($text, $url); } } // Add to main menu $menu_items[] = array('title' => $ref['field']['widget']['label'], 'items' => $items); return $menu_items; }[/geshifilter-drupal6]

$items[] = l($text, $url); - ugye ez standard Drupal linkgyáros, már csak arra kell rávenni, hogy azt a queryt utána tegye, ami csoportba fogja helyezni az új node-ot.

Ehhez ennyi kell:

[geshifilter-drupal6] $url = 'node/'.$node->nid.'/create_reference/'.$i.'/'.$referenceable_type; //innen jön a saját kód. Először megvizsgáljuk, hogy az organic_groups modul létezik-e. if (module_exists('og')) { // ha ok, akkor kérdezzük meg, hogy van-e jelenleg csoportkontextus, vagyis a project node, amin vagyunk, csoportba van-e beküldve $group = og_get_group_context(); //akkor most kérdezzük meg, hogy az a tartalomtípus, amit létre akarunk hozni, egyáltalán csoportba beküldhető tartalom-e if ($group && og_is_group_post_type($referenceable_type)) { //ha igen, akkor használjuk az l függvény opciójaként megadható query-t, amit szépen egy ? után biggyeszt majd a link végére. $options = array ( 'query' => 'gids[]=' . $group->nid , ) ; } } $items[] = l($text, $url, $options); [/geshifilter-drupal6]

Ez csak egyetlen dolgot nem kezel, a nodereferrer_create ugyanis tesz még a node-ra egy fület is. Nekem nincs erre szükségem, mivel saját modulból legyalultam, de akinek van kedve, egy csokiért/sörért/kortypálinkáért a Drupal hétvégén bekommentelhetné, hogy hook_menu_alterben hogyan pattinthatnánk a link mögé queryt. Akár ide is: http://drupal.org/node/949858 :)

Ps. kéretik nem hatalmasak kacagni az angol botladozásaimon, már untam minden issuemhoz odaírni, hogy sorry for my english.

Hozzászólások

Hello There. I found your

Hello There. I found your blog using msn. That is a very well
written article. I will be sure to bookmark it and return to learn more of
your useful info. Thanks for the post. I will certainly comeback.

I am curious to find out what

I am curious to find out what blog platform you are using?
I'm experiencing some small security problems with my latest website and I would like to
find something more safe. Do you have any solutions?

Hello There. I found your

Hello There. I found your blog using msn. This is
a really well written article. I'll make sure to bookmark
it and return to read more of your useful info. Thanks for the post.

I will certainly return.

Hey There. I found your blog

Hey There. I found your blog using msn. This is a really well written article.
I'll be sure to bookmark it and return to read
more of your useful info. Thanks for the post. I'll definitely comeback.

Fantastic beat ! I wish to

Fantastic beat ! I wish to apprentice even as you amend your site,
how can i subscribe for a weblog web site? The account aided
me a acceptable deal. I have been a little bit familiar of this your broadcast provided
brilliant clear idea

I am actually grateful to the

I am actually grateful to the owner of this website who has shared this enormous
article at here.

Investors do pay direct and

Investors do pay direct and indirect costs.

This is the right web site

This is the right web site for anyone who would like to understand this topic.

You know so much its almost hard to argue with you (not that I personally would want to…HaHa).
You certainly put a new spin on a subject that has been written about for many years.
Excellent stuff, just excellent!

When some one searches for

When some one searches for his necessary thing, thus he/she wants to be available that in detail, so that thing
is maintained over here.

Excellent article. Keep

Excellent article. Keep posting such kind of info on your
site. Im really impressed by it.
Hi there, You've performed an incredible job. I'll
definitely digg it and personally suggest to
my friends. I'm sure they'll be benefited from this web site.

Hello there! I know this is

Hello there! I know this is kinda off topic but I'd figured
I'd ask. Would you be interested in trading links or maybe guest authoring a blog article or
vice-versa? My website discusses a lot of the
same topics as yours and I believe we could greatly benefit from each other.
If you're interested feel free to shoot me an email.

I look forward to hearing from you! Great blog by the way!

Thank you for another

Thank you for another magnificent post. The place else may just
anybody get that type of info in such a perfect means of writing?

I've a presentation next week, and I'm on the look for such information.

Terrific work! That is the

Terrific work! That is the kind of information that are
supposed to be shared across the web. Disgrace on Google for now not positioning this post upper!
Come on over and talk over with my web site . Thank you =)

Now it is time to pick your

Now it is time to pick your specific investments.

I'm no longer sure the place

I'm no longer sure the place you're getting your information, but good topic.
I needs to spend some time studying much more or figuring out
more. Thanks for excellent information I used to be looking
for this information for my mission.

Hello everyone, it's my first

Hello everyone, it's my first visit at this web site, and
article is actually fruitful in favor of me, keep up posting these content.

Howdy! I know this is kind of

Howdy! I know this is kind of off topic but I was wondering if you knew where I could locate a captcha plugin for my comment form?
I'm using the same blog platform as yours and I'm having difficulty finding one?
Thanks a lot!

I have been browsing online

I have been browsing online more than 4 hours today, yet I
never found any interesting article like yours. It's pretty worth
enough for me. Personally, if all web owners and bloggers made good content as you did, the internet will be much more useful than ever before.

Now it's time to decide your

Now it's time to decide your specific investments.

Thank you for the good

Thank you for the good writeup. It in fact was a
amusement account it. Look advanced to far added agreeable from you!

By the way, how can we communicate?

My brother recommended I

My brother recommended I might like this blog.
He was totally right. This post truly made my day. You can not imagine
just how much time I had spent for this information! Thanks!

Hey I know this is off topic

Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog
that automatically tweet my newest twitter updates. I've been looking
for a plug-in like this for quite some time and was hoping maybe you would have some experience with
something like this. Please let me know if you run into anything.
I truly enjoy reading your blog and I look forward to your
new updates.

I've been browsing on-line

I've been browsing on-line greater than three hours as of
late, yet I never found any interesting article like yours.
It's lovely value sufficient for me. In my view, if
all site owners and bloggers made just right content as you did,
the web will probably be much more useful than ever before.

Nice answers in return of

Nice answers in return of this query with genuine arguments
and explaining the whole thing concerning that.

Hello there! I could have

Hello there! I could have sworn I've been to this website before but after browsing through
many of the posts I realized it's new to me. Regardless,
I'm certainly delighted I stumbled upon it and I'll be book-marking it
and checking back often!

Greetings from Los angeles!

Greetings from Los angeles! I'm bored to tears at work so I decided
to check out your blog on my iphone during lunch break.
I enjoy the information you present here and can't wait to take a look when I get home.

I'm amazed at how quick your blog loaded on my cell phone ..
I'm not even using WIFI, just 3G .. Anyways, excellent site!

A financial advisor is your

A financial advisor is your planning companion.

This is my first time pay a

This is my first time pay a quick visit at here and i am really pleassant to
read everthing at single place.

Hey there would you mind

Hey there would you mind letting me know which web
host you're utilizing? I've loaded your blog in 3 different web browsers and I must say this
blog loads a lot faster then most. Can you recommend a good
web hosting provider at a honest price? Many thanks, I appreciate it!

We stumbled over here by a

We stumbled over here by a different page and thought I might as well check things out.

I like what I see so now i'm following you. Look forward
to looking into your web page for a second time.

We're trusted

We're trusted Mississauga Heating and Cooling Consultants.

magnificent submit, very

magnificent submit, very informative. I ponder why the opposite specialists of
this sector do not notice this. You must continue your writing.
I'm confident, you've a great readers' base already!

Nice post. I was checking

Nice post. I was checking continuously this blog and I am impressed!
Extremely useful info particularly the last part :) I care for such
info a lot. I was looking for this particular info for a very
long time. Thank you and good luck.

I got this website from my

I got this website from my friend who told me concerning this site
and now this time I am visiting this site and reading very informative content here.

I was curious if you ever

I was curious if you ever considered changing the layout
of your blog? Its very well written; I love what youve got
to say. But maybe you could a little more in the way of content so people
could connect with it better. Youve got an awful lot of text for only
having one or 2 pictures. Maybe you could space it
out better?

Very shortly this web site

Very shortly this web site will be famous among all blog users,
due to it's fastidious content

Now it's time to choose your

Now it's time to choose your particular investments.

Think about investments that

Think about investments that supply fast annuities.

My brother recommended I may

My brother recommended I may like this website. He was totally right.
This put up truly made my day. You can not consider just how
a lot time I had spent for this info! Thank you!

I'm more than happy to

I'm more than happy to uncover this page. I wanted to thank you for ones time
just for this wonderful read!! I definitely really liked every little bit of it and i also have you saved as a favorite to look at new things in your website.

A financial advisor is your

A financial advisor is your planning associate.

It's nearly impossible to

It's nearly impossible to find knowledgeable people in this particular
topic, but you sound like you know what you're talking about!
Thanks

I don't even know how I ended

I don't even know how I ended up here, but I thought this post was good.
I do not know who you are but certainly you're going to a famous blogger if
you are not already ;) Cheers!

Can I simply just say what a

Can I simply just say what a relief to discover a person that really understands what they are talking about
over the internet. You definitely understand how to bring an issue to light and make it
important. More and more people ought to look at this and understand this
side of your story. I can't believe you aren't more popular
because you definitely have the gift.

Hello there, just became

Hello there, just became aware of your blog through Google, and found that it's really informative.

I am gonna watch out for brussels. I will be grateful if
you continue this in future. Numerous people will be benefited from your writing.
Cheers!

It's perfect time to make

It's perfect time to make some plans for the future and it's time
to be happy. I've read this post and if I could I wish to suggest you few interesting
things or tips. Perhaps you could write next articles referring to this article.
I want to read even more things about it!

When I originally commented I

When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a
comment is added I get four e-mails with the same comment.
Is there any way you can remove me from that service?
Appreciate it!

I really like reading an

I really like reading an article that will make people think.

Also, thank you for permitting me to comment!

It's an amazing post for all

It's an amazing post for all the web viewers; they will take advantage
from it I am sure.

You are so interesting! I

You are so interesting! I don't suppose I have read anything
like that before. So wonderful to discover somebody with
some unique thoughts on this subject. Seriously.. many thanks for starting this up.

This site is something that's needed on the web, someone with a little originality!

Hozzászólás

A mező tartalma nem nyilvános.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Engedélyezett HTML elemek: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • A webcímek és email címek automatikusan linkekké alakulnak.
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.
  • Engedélyezett HTML elemek: <a> <blockquote> <br> <cite> <code> <dd> <del> <div> <dl> <dt> <em> <li> <ol> <p> <span> <strong> <ul>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <php>, <python>, <ruby>, <sql>. The supported tag styles are: <foo>, [foo].
  • Minden email cím át lesz alakítva ember által olvasható módon, vagy (ha a JavaScript engedélyezett) ki lesz cserélve kattintható, de biztonságos hivatkozásra.