You are here

public function SearchApiViewsHandlerFilterDate::extra_options_form in Search API 7

Add extra options if we allow the date popup widget.

Overrides views_handler::extra_options_form

File

contrib/search_api_views/includes/handler_filter_date.inc, line 37
Contains SearchApiViewsHandlerFilterDate.

Class

SearchApiViewsHandlerFilterDate
Views filter handler base class for handling date fields.

Code

public function extra_options_form(&$form, &$form_state) {
  parent::extra_options_form($form, $form_state);
  if (module_exists('date_popup')) {
    $widget_options = array(
      'default' => 'Default',
      'date_popup' => 'Date popup',
    );
    $form['widget_type'] = array(
      '#type' => 'radios',
      '#title' => t('Date selection form element'),
      '#default_value' => $this->options['widget_type'],
      '#options' => $widget_options,
    );
    $form['date_popup_format'] = array(
      '#type' => 'textfield',
      '#title' => t('Date format'),
      '#default_value' => $this->options['date_popup_format'],
      '#description' => t('A date in any format understood by <a href="@doc-link">PHP</a>. For example, "Y-m-d" or "m/d/Y".', array(
        '@doc-link' => 'http://php.net/manual/en/function.date.php',
      )),
      '#states' => array(
        'visible' => array(
          ':input[name="options[widget_type]"]' => array(
            'value' => 'date_popup',
          ),
        ),
      ),
    );
  }
  if (module_exists('date_api')) {
    $form['year_range'] = array(
      '#type' => 'date_year_range',
      '#default_value' => $this->options['year_range'],
    );
  }
}