You are here

function taxonomy_pathauto in Pathauto 5

Same name and namespace in other branches
  1. 5.2 pathauto_taxonomy.inc \taxonomy_pathauto()
  2. 6.2 pathauto.module \taxonomy_pathauto()
  3. 6 pathauto_taxonomy.inc \taxonomy_pathauto()
  4. 7 pathauto.module \taxonomy_pathauto()

File

./pathauto_taxonomy.inc, line 7

Code

function taxonomy_pathauto($op) {
  switch ($op) {
    case 'settings':
      $settings = array();
      $settings['module'] = 'taxonomy';
      $settings['groupheader'] = t('Category path settings');
      $settings['patterndescr'] = t('Default path pattern (applies to all vocabularies with blank patterns below)');
      $settings['patterndefault'] = t('[vocab]/[catpath]');
      $settings['placeholders'] = array(
        t('[vocab]') => t("The vocabulary that the page's first category belongs to."),
        t('[cat]') => t('The name of the category.'),
        t('[catpath]') => t('As [cat], but including its supercategories.'),
        t('[tid]') => t('The id number of the category.'),
      );

      // Look for extensions from other modules
      $placeholders = module_invoke_all('pathauto_taxonomy', 'placeholders');
      $settings['placeholders'] = array_merge($settings['placeholders'], $placeholders);
      $settings['supportsfeeds'] = '0/feed';
      $settings['bulkname'] = t('Bulk update category paths');
      $settings['bulkdescr'] = t('Generate aliases for all existing categories which do not already have aliases.');
      $vocabularies = taxonomy_get_vocabularies();
      if (sizeof($vocabularies) > 0) {
        $settings['patternitems'] = array();
        foreach ($vocabularies as $vocab) {
          $vocabname = $vocab->name;
          $fieldlabel = t('Pattern for all %vocab-name paths', array(
            '%vocab-name' => $vocabname,
          ));
          $settings['patternitems'][$vocab->vid] = $fieldlabel;
        }
      }
      return (object) $settings;
    default:
      break;
  }
}