Drupal7自定义模块的URL生成

来源:互联网 发布:linux web服务器优化 编辑:程序博客网 时间:2024/05/16 10:38
/**
* 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)));
}
原创粉丝点击