You are here

function _pathauto_taxonomy_catpath in Pathauto 5

Helper function for the [catpath] placeholder.

3 calls to _pathauto_taxonomy_catpath()
forum_pathauto_bulkupdate in ./pathauto_taxonomy.inc
Generate aliases for all forums and forum containers without aliases
pathauto_taxonomy in ./pathauto_taxonomy.inc
Implementation of hook_taxonomy().
taxonomy_pathauto_bulkupdate in ./pathauto_taxonomy.inc
Generate aliases for all categories without aliases

File

./pathauto_taxonomy.inc, line 210

Code

function _pathauto_taxonomy_catpath($category) {
  if ($category->parent) {
    $catpath = pathauto_cleanstring($category->name);
    $parents = taxonomy_get_parents_all($category->parent);
  }
  else {
    $catpath = '';
    $parents = taxonomy_get_parents_all($category->tid);
  }
  foreach ($parents as $parent) {
    $catpath = pathauto_cleanstring($parent->name) . '/' . $catpath;
  }
  return $catpath;
}