You are here

function alpha_pagination_handler_pagination::options_form in Views Alpha Pagination 7

Our options form.

Overrides views_handler_area::options_form

File

views/alpha_pagination_handler_pagination.inc, line 114
Definition of alpha_pagination_handler_pagination.

Class

alpha_pagination_handler_pagination
Views area handler to display an alphabetic pagination representive of the entire result set for this view and not just the limited number being displayed by the view's configuration

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['pre_letter_path'] = array(
    '#title' => t('Path to results view'),
    '#type' => 'textfield',
    '#size' => 60,
    '#default_value' => $this->options['pre_letter_path'],
    '#description' => t('This is the path to the view that handles the search by letter. No beginning or ending slashes.'),
  );
  if ($this->view->base_table == 'taxonomy_term_data') {

    // Get an array list of all non-image, non-entity or other assorted reference fields.
    $fields = array(
      'name' => 'name',
    );
  }
  else {

    // Get an array list of all non-image, non-entity or other assorted reference fields.
    $fields = array(
      'title' => 'title',
    );
  }
  $compound_field_types = array(
    'name',
  );
  $single_field_types = array(
    'text',
    'text_long',
    'text_with_summary',
  );
  $all_field_types = array_merge($single_field_types, $compound_field_types);
  foreach (field_info_field_map() as $field_name => $field_definition) {
    if (in_array($field_definition['type'], $all_field_types)) {
      if (in_array($field_definition['type'], $compound_field_types)) {
        $field_info = field_info_field($field_name);
        foreach (array_keys($field_info['columns']) as $compoundFieldKey) {
          $compound_field_field_name = sprintf('%s:%s', $field_name, $compoundFieldKey);
          $fields[$compound_field_field_name] = $compound_field_field_name;
        }
      }
      else {
        $fields[$field_name] = $field_name;
      }
    }
  }
  $form['paginate_view_field'] = array(
    '#title' => t('View field to paginate against'),
    '#type' => 'select',
    '#options' => $fields,
    '#default_value' => $this->options['paginate_view_field'],
    '#description' => t('This will be the content field that drives the pagination.'),
  );
  $form['paginate_toggle_empty'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show options without results'),
    '#default_value' => $this->options['paginate_toggle_empty'],
    '#description' => t('Show or hide letters without results'),
  );

  // Class options.
  $form['paginate_classes'] = array(
    '#type' => 'fieldset',
    '#title' => t('Classes'),
    '#description' => t('Provide additional CSS classes on elements in the pagination; separated by spaces.'),
    '#collapsible' => TRUE,
  );
  $form['paginate_class'] = array(
    '#title' => t('Wrapper'),
    '#type' => 'textfield',
    '#default_value' => $this->options['paginate_class'],
    '#description' => t('The wrapper around the item list.'),
    '#fieldset' => 'paginate_classes',
  );
  $form['paginate_list_class'] = array(
    '#title' => t('Item List'),
    '#type' => 'textfield',
    '#default_value' => $this->options['paginate_list_class'],
    '#description' => t('The item list.'),
    '#fieldset' => 'paginate_classes',
  );
  $form['paginate_active_class'] = array(
    '#title' => t('Active item'),
    '#type' => 'textfield',
    '#default_value' => $this->options['paginate_active_class'],
    '#description' => t('The active list item.'),
    '#fieldset' => 'paginate_classes',
  );
  $form['paginate_inactive_class'] = array(
    '#title' => t('Inactive item'),
    '#type' => 'textfield',
    '#default_value' => $this->options['paginate_inactive_class'],
    '#description' => t('The inactive list item(s) that are not links, a.k.a. "no results".'),
    '#fieldset' => 'paginate_classes',
  );
  $form['paginate_link_class'] = array(
    '#title' => t('Link'),
    '#type' => 'textfield',
    '#default_value' => $this->options['paginate_link_class'],
    '#description' => t('The link element.'),
    '#fieldset' => 'paginate_classes',
  );

  // "All" options.
  $form['paginate_all_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('"All" item'),
    '#collapsible' => TRUE,
  );
  $form['paginate_all_display'] = array(
    '#type' => 'select',
    '#title' => t('Display the "All" item'),
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
    ),
    '#default_value' => $this->options['paginate_all_display'],
    '#description' => t('Displays the "All" link in the pagination.'),
    '#fieldset' => 'paginate_all_options',
  );
  $form['paginate_all_position'] = array(
    '#type' => 'select',
    '#title' => t('Position'),
    '#options' => array(
      'before' => t('Before'),
      'after' => t('After'),
    ),
    '#default_value' => $this->options['paginate_all_position'],
    '#description' => t('Determines where the "All" item will show up in the pagination.'),
    '#dependency' => array(
      'edit-options-paginate-all-display' => array(
        1,
      ),
    ),
    '#fieldset' => 'paginate_all_options',
  );
  $form['paginate_all_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label'),
    '#default_value' => $this->options['paginate_all_label'],
    '#description' => t('The label to use for display the "All" item in the pagination.'),
    '#dependency' => array(
      'edit-options-paginate-all-display' => array(
        1,
      ),
    ),
    '#fieldset' => 'paginate_all_options',
  );
  $form['paginate_all_class'] = array(
    '#title' => t('Classes'),
    '#type' => 'textfield',
    '#default_value' => $this->options['paginate_all_class'],
    '#description' => t('CSS classes for "All" item (on <code>&lt;li&gt;</code> element); separated by spaces.'),
    '#dependency' => array(
      'edit-options-paginate-all-display' => array(
        1,
      ),
    ),
    '#fieldset' => 'paginate_all_options',
  );

  // "Numeric" options.
  $form['paginate_numeric_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Numeric items'),
    '#collapsible' => TRUE,
  );
  $form['paginate_view_numbers'] = array(
    '#title' => t('Display numeric items'),
    '#type' => 'select',
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
    ),
    '#default_value' => $this->options['paginate_view_numbers'],
    '#description' => t('Displays numeric (0-9) links in the pagination.'),
    '#fieldset' => 'paginate_numeric_options',
  );
  $form['paginate_numeric_position'] = array(
    '#type' => 'select',
    '#title' => t('Position'),
    '#options' => array(
      'before' => t('Before'),
      'after' => t('After'),
    ),
    '#default_value' => $this->options['paginate_numeric_position'],
    '#description' => t('Determines whether numeric items are shown before or after alphabetical links in the pagination.'),
    '#dependency' => array(
      'edit-options-paginate-view-numbers' => array(
        1,
      ),
    ),
    '#fieldset' => 'paginate_numeric_options',
  );
  $form['paginate_numeric_class'] = array(
    '#title' => t('Classes'),
    '#type' => 'textfield',
    '#default_value' => $this->options['paginate_numeric_class'],
    '#description' => t('CSS classes for numeric item (on <code>&lt;li&gt;</code> element); separated by spaces.'),
    '#dependency' => array(
      'edit-options-paginate-view-numbers' => array(
        1,
      ),
    ),
    '#fieldset' => 'paginate_numeric_options',
  );
}