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.
same motivation as remove $op from hook_user, the time has come for $op in hooks.
Comment | File | Size | Author |
---|---|---|---|
#36 | drupal_nodeapi_documentation.patch | 11.47 KB | recidive |
#35 | drupal_nodeapi_documentation.patch | 10.63 KB | recidive |
#30 | 314244.patch | 10.37 KB | RobLoach |
#25 | nodeapi_docs.patch | 8.51 KB | Anonymous (not verified) |
#19 | nodeapi_prepare_treanslation.patch | 748 bytes | nedjo |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedall tests pass, except for the upload tests that fail on a clean HEAD.
Comment #2
dman CreditAttribution: dman commentedO WOW.
OK, this is better code, which is cool.
This is huge. You are brave.
I don't know what else to say.
Comment #3
webchickSubscribe! Let's kill $op! Kill it dead!
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedwill update this patch once HEAD is fixed.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedupdated for HEAD, all tests pass.
Comment #6
catchAs with the user de-$op patch, there's lots here, and plenty of additional cleanup we can do after it lands. I confirmed that no tests are harmed by the patch, so let's get this in then open up many smaller follow-up issues to clean this API up more.
Comment #7
alexanderpas CreditAttribution: alexanderpas commented+1 and subscribing to this one.
Comment #8
RobLoachThis patch is made of pure awesome.... aka subscribe.
Comment #9
chx CreditAttribution: chx commented(party) (dance) :D yes yes yes please.
Comment #10
dman CreditAttribution: dman commentedPlease don't get out the pitchforks, but would it be unreasonable to supply an old-style nodeapi stub to funnel the requests through to the new functions? I know legacy support is considered evil and all, but this is going to hit a huge number of modules, and I doubt any magic upgrade script will be able to do auto conversions. ... just so we don't fall further into another huge module upgrade lapse like we have with D6? Reduce the pain? The fix would be only a few lines.
Complain in coder.module, trigger "deprecated" notices in watchdog, but help upgraders to make it work first time. :-}
[ .dan. runs and hides ... ]
Comment #11
RobLoachI believe webchick put it the best when she said "Kill it dead!". Besides, all API changes are documented at Converting 6.x modules to 7.x.
Comment #12
alexanderpas CreditAttribution: alexanderpas commentednot to mention.... weŕe not in freeze yet... so a big -1 (where did i left the pitchfork!) at backward compability!
This is the only time we can do this this way, and we have the oppertunity to do it good, so let's kill that bastard consistently and completely ($op that is...)
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commented-1 for keeping a "compatibility layer" from me too.
i think the new shiny is worth the pain, and its consistent with The Drupal Way...
Comment #14
catchOnce this goes in I want to see if we can stuff $teaser and $page into the $node object (if they aren't already) and remove them from the function signatures, so we get closer to just passing a single object around the API by reference. So this is hopefully just the first step at fixing this up.
Comment #15
dman CreditAttribution: dman commentedOk guys, forget I said anything. Just trying to smooth the ride. :-}
Comment #16
BioALIEN CreditAttribution: BioALIEN commented-1 on keeping a "compatibility layer".
The good thing about Drupal is we don't care much about backwards compatibility. This is stated somewhere by an authoritative source so don't quote me :)
Comment #17
Dries CreditAttribution: Dries commentedReviewed, tested, and committed to CVS HEAD. Marking as 'code needs work' until this has been properly documented in the upgrade instructions.
Comment #18
RobLoachAdded the update module documentation for remove $op.
Comment #19
nedjoThe 'prepare translation' op was missed. Attached patch changes it to 'prepare_translation'.
Comment #20
RobLoachYup.
Comment #21
webchickThanks. :)
Marking CNW because the docs in core.php for this are now completely and utterly wrong.
Comment #22
RobLoach*cough* #314870: UNSTABLE-4 blocker: Add api.php for every core module *cough*
Comment #23
webchickYeah, I already chimed in there. I don't feel that issue is going to get solved within the next 2-3 days. But we need documentation for this change ASAP.
Comment #24
Anonymous (not verified) CreditAttribution: Anonymous commentedi've started on this, so if anyone else wants to chime in let me know.
Comment #25
Anonymous (not verified) CreditAttribution: Anonymous commentedhere's a work in progress patch core.php.
note the function signatures - i'd appreciate some feedback. in almost all cases, i think we can eliminate the params formerly knows as $a3 and $a4.
i've created a follow-up issue to clean up the code now we're not stuck with a one-size-fits-all API.
Comment #26
Anonymous (not verified) CreditAttribution: Anonymous commentedchanging title and queue.
Comment #27
RobLoachThis looks good to me.
Comment #28
dman CreditAttribution: dman commentedJust as an aside to those in this issue - today my eye was drawn to code in content.module
I just thought I'd like to say that it made me smile. I like nice code. That is all.
Comment #29
RobLoachNeeds update to head.
Comment #30
RobLoachComment #31
Anonymous (not verified) CreditAttribution: Anonymous commentedthanks Rob.
what's the way to go here? as it is, this is worth committing. who has commit access?
Comment #32
alexanderpas CreditAttribution: alexanderpas commentedlooking good, marking this as RTBC
Comment #33
recidive CreditAttribution: recidive commentedHi, I've posted a list of where/how nodeapi hooks are called. I think this might help here with documenting the correct function signatures.
Comment #34
RobLoachMoved to Drupal core since node.api.php is now in.
Comment #35
recidive CreditAttribution: recidive commentedUpdated the docs to match nodeapi signatures from #319356: Update hook_nodeapi_* functions signatures and documentation.
I'm going to add some examples of hooks implementations.
Comment #36
recidive CreditAttribution: recidive commentedAdded some implementation examples. It's missing examples on hook_nodeapi_alter() and hook_nodeapi_prepare_translation() (I couldn't find module implementing those hooks in core. Also hook_nodeapi_print() doesn't exist anymore, so removing it.
Comment #37
recidive CreditAttribution: recidive commentedMerged documentation to the patch in #319356: Update hook_nodeapi_* functions signatures and documentation.
Changing the title back to "remove $op from hook_nodeapi" for future reference. And closing down the issue.
Comment #38
hass CreditAttribution: hass commentedCould someone in here explain me how it's now possible to have one nodeapi hook doing the same for more than one hook in the same way?
Now this duplicates code n-times... in D6 it was much easier:
Comment #39
dman CreditAttribution: dman commentedMaybe.
Comment #40
joachim CreditAttribution: joachim commentedSee also #708974: provide an overview of ex-hook_nodeapi operations.