You are here

function _node_pathauto in Pathauto 6.2

Implements hook_pathauto().

1 call to _node_pathauto()
node_pathauto in ./pathauto.module
Implements hook_pathauto().

File

./pathauto.pathauto.inc, line 13
Pathauto integration for core modules.

Code

function _node_pathauto($op) {
  switch ($op) {
    case 'settings':
      $settings = array();
      $settings['module'] = 'node';
      $settings['token_type'] = 'node';
      $settings['groupheader'] = t('Node paths');
      $settings['patterndescr'] = t('Default path pattern (applies to all node types with blank patterns below)');
      $settings['patterndefault'] = 'content/[title-raw]';
      $settings['batch_update_callback'] = 'node_pathauto_bulk_update_batch_process';
      $settings['batch_file'] = drupal_get_path('module', 'pathauto') . '/pathauto.pathauto.inc';
      $languages = array();
      if (module_exists('locale')) {
        $languages = array(
          '' => t('language neutral'),
        ) + locale_language_list('name');
      }
      foreach (node_get_types('names') as $node_type => $node_name) {
        if (count($languages) && variable_get('language_content_type_' . $node_type, 0)) {
          $settings['patternitems'][$node_type] = t('Default path pattern for @node_type (applies to all @node_type node types with blank patterns below)', array(
            '@node_type' => $node_name,
          ));
          foreach ($languages as $lang_code => $lang_name) {
            $settings['patternitems'][$node_type . '_' . $lang_code] = t('Pattern for all @language @node_type paths', array(
              '@node_type' => $node_name,
              '@language' => $lang_name,
            ));
          }
        }
        else {
          $settings['patternitems'][$node_type] = t('Pattern for all @node_type paths', array(
            '@node_type' => $node_name,
          ));
        }
      }
      return (object) $settings;
    default:
      break;
  }
}