You are here

function taxonomy_menu_pathauto in Taxonomy menu 5

File

./taxonomy_menu_pathauto.inc, line 6

Code

function taxonomy_menu_pathauto($op) {
  switch ($op) {
    case 'settings':
      $settings = array();
      $settings['module'] = 'taxonomy_menu';
      $settings['token_type'] = 'taxonomy_menu';
      $settings['groupheader'] = t('Taxonomy Menu path settings');
      $settings['patterndescr'] = t('Default path pattern (applies to all vocabularies with blank patterns below)');
      $settings['patterndefault'] = '[tax-menu]/[vocab-raw]/[cat-raw]';
      $patterns = token_get_list('taxonomy_menu');
      foreach ($patterns as $type => $pattern_set) {
        if ($type != 'global') {
          foreach ($pattern_set as $pattern => $description) {
            $settings['placeholders']['[' . $pattern . ']'] = $description;
          }
        }
      }
      $settings['bulkname'] = t('Bulk generate aliases for Taxonomy Menu items');
      $settings['bulkdescr'] = t('Generate aliases for all existing Taxonomy Menu items.');
      $vocabularies = taxonomy_get_vocabularies();
      if (sizeof($vocabularies) > 0) {
        $settings['patternitems'] = array();
        $forum_vid = variable_get('forum_nav_vocabulary', '');
        foreach ($vocabularies as $vocab) {
          if ($vocab->vid != $forum_vid) {
            $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;
  }
}