function path_node_insert
path_node_insert($node)
Implements hook_node_insert().
File
- modules/path/path.module, line 187
- Enables users to rename URLs.
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); } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!path!path.module/function/path_node_insert/7.x