path_taxonomy_term_insert

Versions
7
path_taxonomy_term_insert($term)

Implements hook_taxonomy_term_insert().

Code

modules/path/path.module, line 265

<?php
function path_taxonomy_term_insert($term) {
  if (isset($term->path)) {
    $path = $term->path;
    $path['alias'] = trim($path['alias']);
    // Only save a non-empty alias.
    if (!empty($path['alias'])) {
      // Ensure fields for programmatic executions.
      $path['source'] = 'taxonomy/term/' . $term->tid;
      $path['language'] = LANGUAGE_NONE;
      path_save($path);
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.