function _node_mass_update_helper

Same name in other branches
  1. 9 core/modules/node/node.admin.inc \_node_mass_update_helper()
  2. 8.9.x core/modules/node/node.admin.inc \_node_mass_update_helper()
  3. 10 core/modules/node/node.admin.inc \_node_mass_update_helper()
  4. 11.x core/modules/node/node.admin.inc \_node_mass_update_helper()

Updates individual nodes when fewer than 10 are queued.

Parameters

$nid: ID of node to update.

$updates: Associative array of updates.

Return value

object An updated node object.

See also

node_mass_update()

2 calls to _node_mass_update_helper()
node_mass_update in modules/node/node.admin.inc
Make mass update of nodes, changing all nodes in the $nodes array to update them with the field values in $updates.
_node_mass_update_batch_process in modules/node/node.admin.inc
Implements callback_batch_operation().

File

modules/node/node.admin.inc, line 320

Code

function _node_mass_update_helper($nid, $updates) {
    $node = node_load($nid, NULL, TRUE);
    // For efficiency manually save the original node before applying any changes.
    $node->original = clone $node;
    foreach ($updates as $name => $value) {
        $node->{$name} = $value;
    }
    node_save($node);
    return $node;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.