You are here

function pathauto_node_update_alias in Pathauto 6.2

Same name and namespace in other branches
  1. 6 pathauto.module \pathauto_node_update_alias()
  2. 7 pathauto.module \pathauto_node_update_alias()

Update the URL aliases for an individual node.

Parameters

$node: A node object.

$op: Operation being performed on the node ('insert', 'update' or 'bulkupdate').

$options: An optional array of additional options.

4 calls to pathauto_node_update_alias()
PathautoUnitTestCase::testUpdateActions in ./pathauto.test
Test the different update actions in pathauto_create_alias().
pathauto_nodeapi in ./pathauto.module
Implements hook_nodeapi().
pathauto_node_update_action in ./pathauto.module
Update action wrapper for pathauto_node_update_alias().
pathauto_node_update_alias_multiple in ./pathauto.module
Update the URL aliases for multiple nodes.

File

./pathauto.module, line 448
Main file for the Pathauto module, which automatically generates aliases for content.

Code

function pathauto_node_update_alias($node, $op, $options = array()) {

  // Skip processing if the user has disabled pathauto for the node.
  if (isset($node->pathauto_perform_alias) && empty($node->pathauto_perform_alias) && empty($options['force'])) {
    return;
  }
  $options += array(
    'language' => isset($node->language) ? $node->language : '',
  );

  // Skip processing if the node has no pattern.
  if (!pathauto_pattern_load_by_entity('node', $node->type, $options['language'])) {
    return;
  }
  module_load_include('inc', 'pathauto');
  if ($alias = pathauto_create_alias('node', $op, "node/{$node->nid}", array(
    'node' => $node,
  ), $node->nid, $node->type, $options['language'])) {
    $node->path = $alias;
  }
}