You are here

function _taxonomy_pathauto_alias in Pathauto 6

Same name and namespace in other branches
  1. 5.2 pathauto_taxonomy.inc \_taxonomy_pathauto_alias()

Create aliases for taxonomy objects.

Parameters

$category: A taxonomy object.

3 calls to _taxonomy_pathauto_alias()
forum_pathauto_bulkupdate in ./pathauto_taxonomy.inc
Generate aliases for all forums and forum containers without aliases.
pathauto_taxonomy in ./pathauto.module
Implements hook_taxonomy().
taxonomy_pathauto_bulkupdate in ./pathauto_taxonomy.inc
Generate aliases for all categories without aliases.

File

./pathauto_taxonomy.inc, line 100
Hook implementations for taxonomy module integration.

Code

function _taxonomy_pathauto_alias($category, $op) {
  $count = 0;
  $placeholders = pathauto_get_placeholders('taxonomy', $category);
  $forum_vid = variable_get('forum_nav_vocabulary', '');

  // If we're in a forum vocabulary, also create a forum container, forum, or forum topic alias.
  if (module_exists('forum') && $forum_vid == (int) $category->vid) {
    $source = 'forum/' . $category->tid;
    if (pathauto_create_alias('forum', $op, $placeholders, $source, $category->tid, $category->vid)) {
      $count++;
    }
  }
  else {
    $source = taxonomy_term_path($category);
    if (pathauto_create_alias('taxonomy', $op, $placeholders, $source, $category->tid, $category->vid)) {
      $count++;
    }
  }
  return $count;
}