You are here

function view_alias_form_alter in View Alias 6.2

Same name and namespace in other branches
  1. 7 view_alias.module \view_alias_form_alter()

Implementation of hook_form_alter remove the default form settings and add our own since view alias are different from the regular alaises

File

./view_alias.module, line 90
Hook implementations for view alias module integration.

Code

function view_alias_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'pathauto_admin_settings') {
    unset($form['view_alias']['pathauto_view_alias_pattern']);
    unset($form['view_alias']['token_help']);
    $form['view_alias']['views_to_alias'] = array(
      '#type' => 'fieldset',
      '#title' => t('Views available for aliasing'),
      '#description' => t('Check the views for which aliases should be bulk generated.'),
      '#weight' => -1,
    );
    $aliasable = _get_aliasable_displays();
    foreach ($aliasable as $alias) {
      $voc = taxonomy_vocabulary_load($alias->varg);
      $form['view_alias']['views_to_alias']["pathauto_view_alias_{$alias->path}"] = array(
        '#type' => 'checkbox',
        '#title' => t('View %view, display %display, on path %path, with %vocab arguments.', array(
          '%view' => $alias->view_name,
          '%display' => $alias->display_name,
          '%path' => $alias->path,
          '%vocab' => $voc->name,
        )),
        '#weight' => -1,
        '#default_value' => variable_get("pathauto_view_alias_{$alias->path}", 0),
      );
    }
  }
}