You are here

function auto_nodetitle_operations_update in Automatic Nodetitles 5

Same name and namespace in other branches
  1. 8 auto_nodetitle.module \auto_nodetitle_operations_update()
  2. 6 auto_nodetitle.module \auto_nodetitle_operations_update()
  3. 7 auto_nodetitle.module \auto_nodetitle_operations_update()

Callback function for updating node titles.

1 string reference to 'auto_nodetitle_operations_update'
auto_nodetitle_node_operations in ./auto_nodetitle.module
Implementation of hook_node_operations().

File

./auto_nodetitle.module, line 104
Allows hiding of the node title field and automatic title creation

Code

function auto_nodetitle_operations_update($nodes) {
  foreach ($nodes as $nid) {
    $node = node_load($nid);
    if ($node && auto_nodetitle_is_needed($node)) {
      $previous_title = $node->title;
      auto_nodetitle_set_title($node);

      // Only save if the title has actually changed.
      if ($node->title != $previous_title) {
        node_save($node);
      }
    }
  }
}