You are here

function views_filters_selective_form_views_ui_config_item_form_alter_do in Views Hacks 6

2 calls to views_filters_selective_form_views_ui_config_item_form_alter_do()
views_filters_selective_exposed_form_plugin::options_form in views_filters_selective/views_filters_selective_exposed_form_plugin.inc
Provide a form to edit options for this plugin.
views_filters_selective_form_views_ui_config_item_form_alter in views_filters_selective/views_filters_selective.module
Implementation of hook_form_FORMID_alter() for views_ui_config_item_form.

File

views_filters_selective/views_filters_selective.module, line 302

Code

function views_filters_selective_form_views_ui_config_item_form_alter_do($filter, $options, $view, $dom_id, $show_label = FALSE) {
  $label = '"' . $filter->definition['group'] . ': ' . $filter->definition['title'] . '"';
  $form['vfs_selective'] = array(
    '#type' => 'checkbox',
    '#title' => t('Limit!label values to result set', array(
      '!label' => $show_label ? ' ' . $label : '',
    )),
    '#default_value' => @$options['vfs_selective'],
    '#description' => t('If checked, the only items presented to the user will be the ones present in the result set.'),
  );
  $form['vfs_active'] = array(
    '#type' => 'checkbox',
    '#title' => t('Further limit values to active filters'),
    '#default_value' => @$options['vfs_active'],
    '#description' => t('If checked, the items presented to the user will be further restricted according to
       the values of all active exposed filters (i.e., those with selected values).'),
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      $dom_id => array(
        1,
      ),
    ),
  );
  $fields = array(
    0 => t('- Default -'),
  );
  $display = isset($view->display[$view->current_display]->display_options['fields']) ? $view->display[$view->current_display] : $view->display['default'];
  if (!empty($display->display_options['fields'])) {
    foreach ($display->display_options['fields'] as $field_id => $field) {
      $fields["field:{$field_id}"] = t('!field', array(
        '!field' => empty($field['label']) ? $field_id : $field['label'],
      ));
    }
  }
  $form['vfs_field'] = array(
    '#type' => 'select',
    '#title' => t('Limiting field'),
    '#default_value' => @$options['vfs_field'],
    '#description' => t('Leave this as Default unless a specific filter is not handled properly. In that case, you can create a field that holds the possible filter values.'),
    '#options' => $fields,
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      $dom_id => array(
        1,
      ),
    ),
  );
  $form['vfs_hide_empty'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide if empty'),
    '#default_value' => @$options['vfs_hide_empty'],
    '#description' => t('Hide the exposed filter if no values apply to the current view results.'),
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      $dom_id => array(
        1,
      ),
    ),
  );
  $form['vfs_optional'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force optional'),
    '#default_value' => @$options['vfs_optional'],
    '#description' => t('Force the exposed filter of a converted text field to include an "Any" value.'),
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      $dom_id => array(
        1,
      ),
    ),
  );
  return $form;
}