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.
This is sort of a regression, I think.
With the former monolithic hook_nodeapi, you could act on insert and update together -- in other words when new data is arriving in the node. There are cases where you don't need to distinguish whether the actual node is new or not, you just want to act when stuff happens. Userpoints might be one example; any module in general that wants to do something with fresh node data.
It used to be you could say:
// implementation of hook_nodeapi
case 'insert':
case 'update':
// do stuff that applies to both
break;
And now you can't.
Comments
Comment #1
mlncn CreditAttribution: mlncn commentedTrue, there is a slight loss of convenience here.
It is nearly as easy, arguably clearer, and takes about the same amount of code (given that the switch statement and case calls can be removed) to abstract the common code into another function:
benjamin, agaric