You are here

function node_pathauto in Pathauto 5.2

Same name and namespace in other branches
  1. 5 pathauto_node.inc \node_pathauto()
  2. 6.2 pathauto.module \node_pathauto()
  3. 6 pathauto_node.inc \node_pathauto()
  4. 7 pathauto.module \node_pathauto()

Implementation of hook_pathauto().

File

./pathauto_node.inc, line 13
Hook implementations for node module integration.

Code

function node_pathauto($op) {
  switch ($op) {
    case 'settings':
      $settings = array();
      $settings['module'] = 'node';
      $settings['token_type'] = 'node';
      $settings['groupheader'] = t('Node path settings');
      $settings['patterndescr'] = t('Default path pattern (applies to all node types with blank patterns below)');
      $settings['patterndefault'] = t('content/[title-raw]');
      $settings['bulkname'] = t('Bulk generate aliases for nodes that are not aliased');
      $settings['bulkdescr'] = t('Generate aliases for all existing nodes which do not already have aliases.');
      $patterns = token_get_list('node');
      foreach ($patterns as $type => $pattern_set) {
        if ($type != 'global') {
          foreach ($pattern_set as $pattern => $description) {
            $settings['placeholders']['[' . $pattern . ']'] = $description;
          }
        }
      }
      $settings['supportsfeeds'] = 'feed';
      foreach (node_get_types('names') as $node_type => $node_name) {
        $fieldlabel = t('Pattern for all @node_type paths', array(
          '@node_type' => $node_name,
        ));
        $settings['patternitems'][$node_type] = $fieldlabel;
      }
      return (object) $settings;
    default:
      break;
  }
}