You are here

function pathauto_node_update_alias in Pathauto 7

Same name and namespace in other branches
  1. 6.2 pathauto.module \pathauto_node_update_alias()
  2. 6 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.

5 calls to pathauto_node_update_alias()
PathautoUnitTestCase::testUpdateActions in ./pathauto.test
Test the different update actions in pathauto_create_alias().
pathauto_node_insert in ./pathauto.module
Implements hook_node_insert().
pathauto_node_update in ./pathauto.module
Implements hook_node_update().
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 742
Main file for the Pathauto module, which automatically generates aliases for content.

Code

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

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

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