You are here

function path_node_update in Drupal 7

Implements hook_node_update().

File

modules/path/path.module, line 205
Enables users to rename URLs.

Code

function path_node_update($node) {
  if (isset($node->path)) {
    $path = $node->path;
    $path['alias'] = isset($path['alias']) ? trim($path['alias']) : '';

    // Delete old alias if user erased it.
    if (!empty($path['pid']) && !$path['alias']) {
      path_delete($path['pid']);
    }
    path_node_insert($node);
  }
}