Drupal7自定义模块的URL生成

/**
* Implements hook_taxonomy_term_insert
*/
function example_taxonomy_term_insert($term)
{
  example_taxonomy_term_update($term);
}

/**
* Implements hook_taxonomy_term_update
*/
function example_taxonomy_term_update($term)
{
  $path = array(
    'source' => sprintf('term/%d', $term->tid),
    'alias' => sprintf('category/%s',
      pathauto_cleanstring($term->name),
    )
  );
  path_save($path);
}

/**
* Implements hook_taxonomy_term_delete
*/
function example_taxonomy_term_delete($term)
{
  path_delete(array('source' => sprintf('term/%d', $term->tid)));
}

你可能感兴趣的:(url,delete,insert,Path,hook)