You are here

function _uc_catalog_pathauto_alias in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_catalog/uc_catalog.module \_uc_catalog_pathauto_alias()
  2. 6.2 uc_catalog/uc_catalog.module \_uc_catalog_pathauto_alias()

Creates aliases for taxonomy objects.

Parameters

$category: A taxonomy object.

3 calls to _uc_catalog_pathauto_alias()
uc_catalog_pathauto_bulkupdate in uc_catalog/uc_catalog.pathauto.inc
Implements hook_pathauto_bulkupdate().
uc_catalog_taxonomy_term_insert in uc_catalog/uc_catalog.module
Implements hook_taxonomy_term_insert().
uc_catalog_taxonomy_term_update in uc_catalog/uc_catalog.module
Implements hook_taxonomy_term_update().

File

uc_catalog/uc_catalog.pathauto.inc, line 86
Pathauto hooks.

Code

function _uc_catalog_pathauto_alias($category, $op) {
  module_load_include('inc', 'pathauto');
  $count = 0;
  if ($category->vid == variable_get('uc_catalog_vid', 0)) {

    // Check that the term has its bundle, which is the vocabulary's machine name.
    if (!isset($category->vocabulary_machine_name)) {
      $vocabulary = taxonomy_vocabulary_load($term->vid);
      $category->vocabulary_machine_name = $vocabulary->machine_name;
    }
    $src = uc_catalog_path($category);
    if ($alias = pathauto_create_alias('uc_catalog', $op, $src, array(
      'term' => $category,
    ), $category->vocabulary_machine_name)) {
      $count++;
    }
  }
  return $count;
}