Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I think that node_node_type_insert (implements hook_node_type_insert) can be removed from content_types.inc for two reasons:
- The code used in this function is a duplicate of node_node_type_update, which checks for an old $info->type, but that's never been set in the function, so the code never get's executed.
-There's already a message given on creation of a content type in node_type_form_submit. So should we use node_node_type_insert to display a message as confirmation of creating a new content type, you would get two messages saying the same thing. I assume that's kinda unneeded ?
Comment | File | Size | Author |
---|---|---|---|
#1 | drupal_remove_node_node_type_insert-1416900-1.patch | 903 bytes | 30equals |
Comments
Comment #1
30equals CreditAttribution: 30equals commentedi created a patch which basicly removes node_node_type_insert.
Comment #2
Jody LynnI agree with that assessment. This was added in commit 84afe0d9 for review.
Comment #3
Dries CreditAttribution: Dries commentedThis looks ok to me, but it would be good to get another +1 from a node/entity system expert.
Comment #4
sunI got heavily confused as I mistakenly believed you were talking about node_node_type_update().
But yeah, the _insert hook is totally obsolete. The condition can never be true, since it is always old_type == type on node type creation.
This duplicate + needless hook implementation was most likely introduced when we converted most of the hooks in core to no longer use an $op parameter, but instead separate insert/update/etc hook names.
So this is good to go. :)
Comment #5
Dries CreditAttribution: Dries commentedThanks for the extra +1, sun. Committed to 8.x.