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.
Just a patch to add the hook to the API.
Comment | File | Size | Author |
---|---|---|---|
#8 | add-2511484-8.patch | 724 bytes | mglaman |
add_hook_commerce_order_delete.patch | 752 bytes | nvahalik | |
Comments
Comment #1
nvahalik CreditAttribution: nvahalik at Centarro commentedComment #2
joelpittetNeeds a new line at the bottom but that can be fixed on commit. Thanks @nvahalik
Comment #3
joelpittetThis isn't a feature it's really a doc task.
Comment #4
rszrama CreditAttribution: rszrama commentedI personally might favor a single doc block in a commerce.api.php file for hook_ENTITY_TYPE_delete(). May as well cover all the bases with one function per relevant CRUD operation instead of adding them to the individual files. Thoughts?
Comment #5
joelpittetThis one seems a bit more helpful as an example API usage but if you want to make it generic and all the commerce entities have _delete, maybe that's works better for you.
Comment #6
nvahalik CreditAttribution: nvahalik commentedIMO, entity-specific hooks are important because they can provide useful context and that is always a good thing to have. Another reason it is nice to for discoverability. Having *_ENTITY_*() hooks are wonderful, but unless you are looking very specifically for them, they can be a bit harder to find and use than if they are explicitly defined.
Comment #7
joelpittet+1 to #6 that's what I meant but written better:)
Comment #8
mglamanMy patch just fixes newline warning. +1 to individual entity hooks because PhpStorm and other IDEs provide hook completion. It also provides a way to "jump" to the doc in api.php for better explaination. Can't get that from a generic placement. Also, you'd then be overriding it for everyone with hook_ENTITY_TYPE_delete
Comment #9
mglamanAdjusting credit & committing info: EDIT.. apparently can't save the authorship!
Comment #10
mglaman