function path_node_insert
Implements hook_node_insert().
1 call to path_node_insert()
- path_node_update in modules/path/ path.module 
- Implements hook_node_update().
File
- 
              modules/path/ path.module, line 188 
Code
function path_node_insert($node) {
  if (isset($node->path) && isset($node->path['alias'])) {
    $path = $node->path;
    $path['alias'] = trim($path['alias']);
    // Only save a non-empty alias.
    if (!empty($path['alias'])) {
      // Ensure fields for programmatic executions.
      $langcode = entity_language('node', $node);
      $path['source'] = 'node/' . $node->nid;
      $path['language'] = isset($langcode) ? $langcode : LANGUAGE_NONE;
      path_save($path);
    }
  }
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
