You are here

function taxonomy_pathauto in Pathauto 7

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

Implements hook_pathauto() on behalf of taxonomy module.

File

./pathauto.module, line 810
Main file for the Pathauto module, which automatically generates aliases for content.

Code

function taxonomy_pathauto($op) {
  if ($op == 'settings') {
    $settings = array();
    $settings['module'] = 'taxonomy_term';
    $settings['token_type'] = 'term';
    $settings['groupheader'] = t('Taxonomy term paths');
    $settings['patterndescr'] = t('Default path pattern (applies to all vocabularies with blank patterns below)');
    $settings['patterndefault'] = '[term:vocabulary]/[term:name]';
    $settings['batch_update_callback'] = 'taxonomy_pathauto_bulk_update_batch_process';
    $settings['batch_file'] = drupal_get_path('module', 'pathauto') . '/pathauto.pathauto.inc';
    $vocabularies = taxonomy_get_vocabularies();
    if (count($vocabularies)) {
      $settings['patternitems'] = array();
      foreach ($vocabularies as $vid => $vocabulary) {
        if ($vid == variable_get('forum_nav_vocabulary', '')) {

          // Skip the forum vocabulary.
          continue;
        }
        $settings['patternitems'][$vocabulary->machine_name] = t('Pattern for all %vocab-name paths', array(
          '%vocab-name' => $vocabulary->name,
        ));
      }
    }
    return (object) $settings;
  }
}