API page: http://api.drupal.org/api/drupal/modules--node--node.api.php/function/ho...

All hooks are supposed to have function bodies. This one doesn't. The sample could come from two core implementations of this hook (possibly simplified)... probably a good Novice project?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sree’s picture

Assigned: Unassigned » Sree

I am open to update this & provide the patch

xjm’s picture

Hi @Sree,

Thanks for taking this on. Are you still working on this issue? If not, we'll unassign it in a day or two so that someone else can give it a try. (Feel free to assign it back to yourself if you'd still like to work on it, as well.) Thanks!

30equals’s picture

Assigned: Sree » Unassigned
Status: Active » Needs review
FileSize
547 bytes

Hi there,

I came across this issue, and thought i'd supply a basic batch. I added a simple function body to illustrate the hook.
I hope it's sufficient like this :)

marvil07’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good, it's a simple example and it does not really need any extra comments since the output message explain it.

I would say it's ok.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/node/node.api.phpundefined
@@ -984,6 +984,9 @@ function hook_ranking() {
+    drupal_set_message('Changed the content type from %old-type to %type.', array('%old-type' => $info->old_type, '%type' => $info->type));

Shouldn't this be in t()?

-22 days to next Drupal core point release.

marvil07’s picture

Status: Needs work » Needs review
FileSize
550 bytes
jhodgdon’s picture

Status: Needs review » Needs work

Um... This is for hook_node_type_insert(), not hook_node_type_update(), right? In which case, I don't think there is an "old type"?

marvil07’s picture

Status: Needs work » Needs review
FileSize
457 bytes

I need to pay more attention :-p

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That's better. :) It's not a very useful sample function body, but I guess it gets the point across.

Dries’s picture

It is a bit confusing that the machine name is $type but I'm okay with this example.

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

Well, that is what the content type object's field name is... I think the example is clear enough, since it says "with machine name %type", but it would be easy enough to change it to %machine_name, which would definitely get rid of all confusion...

marvil07’s picture

Status: Needs work » Needs review
FileSize
473 bytes
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

RTBC again, thanks! :)

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x and 8.x. Thanks!

marvil07’s picture

Status: Fixed » Reviewed & tested by the community

It seems like the patch included on both 7.x and 8.x was the one on comment 8(not the one on comment 12).

Was it a mistake? If so, please re-close again.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

This was on purpose. Sorry for not being more clear.

xjm’s picture

So what was the reasoning for using #8 instead of #12?

Automatically closed -- issue fixed for 2 weeks with no activity.