You are here

function FacetapiAjaxWidget::settingsForm in Ajax facets 7.3

Same name and namespace in other branches
  1. 7.2 plugins/facetapi/ajax_widget.inc \FacetapiAjaxWidget::settingsForm()

Overrides FacetapiWidget::settingsForm().

2 calls to FacetapiAjaxWidget::settingsForm()
FacetapiAjaxWidgetCheckboxes::settingsForm in plugins/facetapi/ajax_widget_checkboxes.inc
Overrides FacetapiWidget::settingsForm().
FacetapiAjaxWidgetSelect::settingsForm in plugins/facetapi/ajax_widget_select.inc
Overrides FacetapiWidget::settingsForm().
2 methods override FacetapiAjaxWidget::settingsForm()
FacetapiAjaxWidgetCheckboxes::settingsForm in plugins/facetapi/ajax_widget_checkboxes.inc
Overrides FacetapiWidget::settingsForm().
FacetapiAjaxWidgetSelect::settingsForm in plugins/facetapi/ajax_widget_select.inc
Overrides FacetapiWidget::settingsForm().

File

plugins/facetapi/ajax_widget.inc, line 19
Base ajax_facets widget

Class

FacetapiAjaxWidget
Widget that renders facets as a list of clickable links.

Code

function settingsForm(&$form, &$form_state) {
  $settings = $this->settings->settings;
  $form['widget']['widget_settings']['ajax'][$this->id]['wrapper_container'] = [
    '#type' => 'container',
    '#states' => [
      'visible' => [
        'select[name="widget"]' => [
          'value' => $this->id,
        ],
      ],
    ],
  ];
  $form['widget']['widget_settings']['ajax'][$this->id]['show_reset_link'] = [
    '#type' => 'checkbox',
    '#title' => t('Display reset link'),
    '#default_value' => !empty($settings['show_reset_link']),
    '#description' => t('Display the link to reset facet.'),
    '#states' => [
      'visible' => [
        'select[name="widget"]' => [
          'value' => $this->id,
        ],
      ],
    ],
  ];
  $form['widget']['widget_settings']['ajax'][$this->id]['reset_link_text'] = [
    '#type' => 'textfield',
    '#title' => t('Reset link text'),
    '#default_value' => !empty($settings['reset_link_text']) ? $settings['reset_link_text'] : 'Reset filter',
    '#states' => [
      'visible' => [
        'select[name="widget"]' => [
          'value' => $this->id,
        ],
      ],
    ],
  ];
  $form['widget']['widget_settings']['ajax'][$this->id]['wrapper_container']['wrapper_code'] = [
    '#type' => 'markup',
    '#markup' => '<div class="form-item messages warning">' . t('Please select "@empty" as "@d_text". It\'s need for avoid problem, when some facets was empty on page and cannot be loaded again after
          than values of other facets will be changed.
          ', [
      '@empty' => t('Empty facet behavior'),
      '@d_text' => t('Display ajax_facets wrapper'),
    ]) . '<br />' . t('More info here !link', [
      '!link' => l('https://drupal.org/node/2081831', 'https://drupal.org/node/2081831'),
    ]) . '</div>',
  ];
  $form['#submit'] = empty($form['#submit']) ? [] : $form['#submit'];
  if (array_search('ajax_facets_facet_settings_form_submit', $form['#submit']) === FALSE) {
    $form['#submit'][] = 'ajax_facets_facet_settings_form_submit';
  }
}