You are here

function FacetapiAjaxWidget::settingsForm in Ajax facets 7.2

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

Overrides FacetapiWidget::settingsForm().

1 call to FacetapiAjaxWidget::settingsForm()
FacetapiAjaxWidgetCheckboxes::settingsForm in plugins/facetapi/ajax_widget_checkboxes.inc
Overrides FacetapiWidget::settingsForm().
1 method overrides FacetapiAjaxWidget::settingsForm()
FacetapiAjaxWidgetCheckboxes::settingsForm in plugins/facetapi/ajax_widget_checkboxes.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) {
  $form['widget']['widget_settings']['links'][$this->id]['wrapper_container'] = array(
    '#type' => 'container',
    '#states' => array(
      'visible' => array(
        'select[name="widget"]' => array(
          'value' => $this->id,
        ),
      ),
    ),
  );
  $form['widget']['widget_settings']['ajax'][$this->id]['update_results'] = array(
    '#type' => 'checkbox',
    '#title' => t('Update results by ajax'),
    '#default_value' => !empty($this->settings->settings['update_results']),
    '#description' => t('If active, then search results will be updated by AJAX when facet was changed.
       If not active, then after than facet will be updated, user will see special popup with link for filter results.'),
    '#states' => array(
      'visible' => array(
        'select[name="widget"]' => array(
          'value' => $this->id,
        ),
      ),
    ),
  );
  $form['widget']['widget_settings']['ajax'][$this->id]['show_reset_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display reset link'),
    '#default_value' => !empty($this->settings->settings['show_reset_link']),
    '#description' => t('Display link for reset facet.'),
    '#states' => array(
      'visible' => array(
        'select[name="widget"]' => array(
          'value' => $this->id,
        ),
      ),
    ),
  );
  $searcher = $this->facet
    ->getAdapter()
    ->getSearcher();
  $class = drupal_html_class("facetapi-facet-{$searcher}-{$this->realm['name']}-{$this->facet['name']}");
  $form['widget']['widget_settings']['links'][$this->id]['wrapper_container']['wrapper_code'] = array(
    '#type' => 'markup',
    '#markup' => '<div class="form-item messages warning">' . t('Please select "@empty" as @d_text. Use "Full html" as format and add this wrapper as empty 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.
          ', array(
      '@empty' => t('Empty facet behavior'),
      '@d_text' => t('Display text'),
    )) . '<br />' . t('More info here !link', array(
      '!link' => l('https://drupal.org/node/2081831', 'https://drupal.org/node/2081831'),
    )) . '<br /><br />' . check_plain('<div class="facet-wrapper-selectbox ' . $class . '"></div>') . '</div>',
  );
}