settings->settings; $form['widget']['widget_settings']['ajax'][$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]['show_reset_link'] = array( '#type' => 'checkbox', '#title' => t('Display reset link'), '#default_value' => !empty($settings['show_reset_link']), '#description' => t('Display the link to reset facet.'), '#states' => array( 'visible' => array( 'select[name="widget"]' => array('value' => $this->id), ), ), ); $form['widget']['widget_settings']['ajax'][$this->id]['reset_link_text'] = array( '#type' => 'textfield', '#title' => t('Reset link text'), '#default_value' => !empty($settings['reset_link_text']) ? $settings['reset_link_text'] : 'Reset filter', '#states' => array( 'visible' => array( 'select[name="widget"]' => array('value' => $this->id), ), ), ); $form['widget']['widget_settings']['ajax'][$this->id]['wrapper_container']['wrapper_code'] = array( '#type' => 'markup', '#markup' => '
', ); $form['#submit'] = empty($form['#submit']) ? array() : $form['#submit']; if (array_search('ajax_facets_facet_settings_form_submit', $form['#submit']) === FALSE) { $form['#submit'][] = 'ajax_facets_facet_settings_form_submit'; } } /** * Returns uuid for the facet widget. * It's need to identify the facet option. * @param null $value * Some facets have many separate input elements. For example checkboxes or links. * We need $value to identify each option. */ protected function getAjaxFacetsUuid($value = NULL) { switch ($this->id) { case 'facetapi_ajax_select': case 'facetapi_ajax_ranges': return str_replace('_', '-', $this->id) . '-' . str_replace(array('_', ' ', ':'), '-', $this->key); break; case 'facetapi_ajax_links': case 'facetapi_ajax_checkboxes': return str_replace('_', '-', $this->id) . '-' . str_replace(array('_', ' ', ':'), '-', $this->key . '-' . drupal_strtolower($value)); break; } } /** * Implements FacetapiWidget::execute(). * * Transforms the render array into something that can be themed by * theme_item_list(). * * @see FacetapiWidgetLinks::setThemeHooks() * @see FacetapiWidgetLinks::buildListItems() */ public function execute() { $element = &$this->build[$this->facet['field alias']]; // Sets each item's theme hook, builds item list. $this->setThemeHooks($element); $item_list = array( '#theme' => 'item_list', '#items' => $this->buildListItems($element), '#attributes' => $this->build['#attributes'], ); // We cannot use drupal_html_id to save the same id for each facet. $wrapper_id = $this->build['#attributes']['id'] . '-wrapper'; $element = array( '#markup' => '