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)));
}
posted @ 2011-09-21 11:33  猫之良品  阅读(729)  评论(0编辑  收藏  举报