You are here

function _taxonomy_pathauto_alias in Pathauto 5.2

Same name and namespace in other branches
  1. 6 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
Implementation of hook_taxonomy().
taxonomy_pathauto_bulkupdate in ./pathauto_taxonomy.inc
Generate aliases for all categories without aliases.

File

./pathauto_taxonomy.inc, line 102
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) {
    $src = 'forum/' . $category->tid;
    if (pathauto_create_alias('forum', $op, $placeholders, $src, $category->tid, $category->vid)) {
      $count++;
    }
  }
  else {
    $src = taxonomy_term_path($category);
    if (pathauto_create_alias('taxonomy', $op, $placeholders, $src, $category->tid, $category->vid)) {
      $count++;
    }
  }
  return $count;
}