Move node_mass_update_* functions to service and fix invalid hook invocation in NodeHooks

Created on 30 June 2025, 4 days ago

Problem/Motivation

node.admin.inc is 180 lines of procedural code that should be moved to a service/class.

@berdir also found in https://www.drupal.org/project/drupal/issues/3532204#comment-16170601 πŸ“Œ Move preprocess functions into NodeThemeHooks Active that node_mass_update is being invoked as if it were a hook in NodeHooks::userCancelBlockUnpublish/userCancelReassign which needs to change as these are not hooks.

Steps to reproduce

N/A

Proposed resolution

Move all functions in node.admin.inc to a class/service
Fix documentation, including user.api.php (this should probably just change to an example rather than a concrete call)
Deprecate node_mass_update

Remaining tasks

All of it

User interface changes

N/A

Introduced terminology

N/A

API changes

node_mass_update is deprecated

Data model changes

N/A

Release notes snippet

N/A

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

node system

Created by

πŸ‡¦πŸ‡ΊAustralia acbramley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @acbramley
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Fun fact! I first found the oddity that is node mass update here πŸ“Œ [ignore] Convert everything everywhere all at once Active which is why I knew it wasn't a hook in the first place even though it goes through through module handler invoke.

    There are not many of these types of calls left in core.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    This is barely used in contrib, it would be nice if we could overhaul this with something more modern but maybe that could be done in follow-ups http://codcontrib.hank.vps-private.net/search?text=node_mass_update%28%2...

    Speaking internally, @larowlan suggested changing the $updates array to a static closure that takes the loaded $node and would allow us to just call API directly. I think this would be a huge improvement and would be good for a follow up.

  • Pipeline finished with Failed
    3 days ago
    Total: 177s
    #535805
  • Pipeline finished with Failed
    3 days ago
    Total: 144s
    #535817
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    We chatted about naming internally and landed on NodeBulkUpdate::process, the word "mass" doesn't really get used a lot in Drupal so this seemed to fit better.

    Setting to NR to get some eyes on it, agree on the naming, then I'll fix up the CR and make any further changes.

    All tests for this are in core/modules/user/tests/src/Functional/UserCancelTest.php

  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Success
    3 days ago
    Total: 493s
    #535820
  • Pipeline finished with Success
    3 days ago
    Total: 1197s
    #536581
Production build 0.71.5 2024