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.
Follow-up for #111715: Convert node/content types into configuration
Problem/Motivation
Currently there's a hooks:
hook_load, hook_prepare, hook_view, hook_form, hook_validate, hook_insert, hook_update, hook_delete
That have similar hooks with node prefix - hook_node_insert
Also there's hook_ranking but depends on node...
Proposed resolution
Stop support node_hook()
and remove usage of node_invoke()
Modules should move their implementations into corresponding hook_node_*()
space and use hook_form_alter*()
to modify node form
Remaining tasks
- Drop usage
- Change notice
Comment | File | Size | Author |
---|---|---|---|
#12 | node-hook-2018375-12.patch | 34.39 KB | andypost |
#12 | interdiff.txt | 9.09 KB | andypost |
#9 | interdiff.txt | 587 bytes | andypost |
#9 | node-hook-2018375-8.patch | 26.11 KB | andypost |
#6 | interdiff.txt | 5.87 KB | andypost |
Comments
Comment #1
andypostDeprecated, and removed hooks docs
-
hook_form
moved tohook_node_form
Comment #2
Crell CreditAttribution: Crell commentedI thought we'd removed hook_load and friends already. Yes please, they all need to die.
Why not just remove?
Comment #4
andypostLet's try to drop and
node_invoke()
to help #353494: Remove node_invoke(), comment_invoke(), etcComment #5
catchIs this really always set? Otherwise looks amazing.
Comment #6
andypostFix for remains
Comment #7
BerdirThis still talks about node_invoke().
That actually exists?
The @defgroup definition is right above node_content_form(), looks like we can kill that? anything left that references it?
Agreed, this looks great.
Comment #8
andypostdrop @defgroup
Suppose it was last
Comment #9
andypostComment #10
catchDon't see anything left to do here.
Comment #11
dmitrii CreditAttribution: dmitrii commentedHere is some old hooks mentions in comments.
If anyone with good English please check.
/d8/core/modules/node/node.api.php (2 hits)
Line 510: * read from the database or the entity cache, hook_load() is invoked on the
Line 521: * module defines a content type, you can use hook_load() to respond to
/d8/core/modules/node/node.api.php (1 hits)
Line 400: * hook_delete() has been invoked, but before hook_entity_predelete() and
/d8/core/modules/file/lib/Drupal/file/Tests/ValidateTest.php (1 hits)
Line 40: // Now test for failures in validators passed in and by hook_validate.
/d8/core/modules/node/node.api.php (1 hits)
Line 731: * hook_validate() is invoked.
/d8/core/modules/node/node.api.php (1 hits)
Line 677: * type-specific hook_update() is invoked, and after field_attach_update() is
/d8/core/modules/node/node.api.php (2 hits)
Line 25: * content type as "forum", so during creation of a forum node, hook_insert() is
Line 457: * type-specific hook_insert() is invoked, and after field_attach_insert() is
/d8/core/modules/node/lib/Drupal/node/NodeFormController.php (1 hits)
Line 23: * Fills in a few default values, and then invokes hook_prepare() on the node
/d8/core/modules/node/node.api.php (1 hits)
Line 612: * type-specific hook_prepare() is invoked.
Comment #12
andypostDrop remains. Changed comments needs review
Comment #13
ParisLiakos CreditAttribution: ParisLiakos commentedcouldnt find occurences and docs look good
Comment #14
catchCommitted/pushed to 8.x, thanks!
Will need a change notice.
Comment #15
andypostNext target
comment_invoke()
#353494: Remove node_invoke(), comment_invoke(), etcComment #16
andypostMentioned about the change in https://drupal.org/node/2029519 do we really need separate notice?
Comment #17
catchNo that's plenty, thanks!
Comment #18.0
(not verified) CreditAttribution: commentedUpdated issue summary.
Comment #19
xjm