You are here

function group_pathauto in Group 7

Implements hook_pathauto().

File

./group.pathauto.inc, line 21
Hook implementations for the Pathauto module.

Code

function group_pathauto($op) {
  if ($op != 'settings') {
    return;
  }
  if (!module_exists('entity_token')) {
    return;
  }
  $settings = array(
    'module' => 'group',
    'token_type' => 'group',
    'groupheader' => t('Group paths'),
    'patterndescr' => t('Default path pattern (applies to all group types with blank patterns below)'),
    'patterndefault' => 'group/[group:title]',
    'batch_update_callback' => 'group_pathauto_bulk_update_batch_process',
    'batch_file' => drupal_get_path('module', 'group') . '/group.pathauto.inc',
  );
  $languages = array();
  if (module_exists('locale')) {
    $languages = array(
      LANGUAGE_NONE => t('language neutral'),
    ) + locale_language_list('name');
  }
  foreach (group_type_labels() as $name => $label) {
    if (count($languages)) {
      $settings['patternitems'][$name] = t('Default path pattern for @group_type (applies to all @group_type groups with blank patterns below)', array(
        '@group_type' => $label,
      ));
      foreach ($languages as $lang_code => $lang_name) {
        $settings['patternitems'][$name . '_' . $lang_code] = t('Pattern for all @language @group_type paths', array(
          '@group_type' => $label,
          '@language' => $lang_name,
        ));
      }
    }
    else {
      $settings['patternitems'][$name] = t('Pattern for all @group_type paths', array(
        '@group_type' => $label,
      ));
    }
  }
  return (object) $settings;
}