function node_mass_update
Updates all nodes in the passed-in array with the passed-in field values.
IMPORTANT NOTE: This function is intended to work when called from a form submission handler. Calling it outside of the form submission process may not work correctly.
Parameters
array $nodes: Array of node nids or nodes to update.
array $updates: Array of key/value pairs with node field names and the value to update that field to.
string $langcode: (optional) The language updates should be applied to. If none is specified all available languages are processed.
bool $load: (optional) TRUE if $nodes contains an array of node IDs to be loaded, FALSE if it contains fully loaded nodes. Defaults to FALSE.
bool $revisions: (optional) TRUE if $nodes contains an array of revision IDs instead of node IDs. Defaults to FALSE; will be ignored if $load is FALSE.
Deprecated
in drupal:11.3.0 and is removed from drupal:13.0.0. Use \Drupal::service(\Drupal\node\NodeBulkUpdate::class)->process() instead.
See also
https://www.drupal.org/node/3533315
File
-
core/
modules/ node/ node.admin.inc, line 34
Code
function node_mass_update(array $nodes, array $updates, $langcode = NULL, $load = FALSE, $revisions = FALSE) : void {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. Use \\Drupal::service(\\Drupal\\node\\NodeBulkUpdate::class)->process() instead. See https://www.drupal.org/node/3533315', E_USER_DEPRECATED);
\Drupal::service(NodeBulkUpdate::class)->process($nodes, $updates, $langcode, $load, $revisions);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.