You are here

public function GlossaryAZWidget::buildConfigurationForm in Search API AZ Glossary 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/facets/widget/GlossaryAZWidget.php \Drupal\search_api_glossary\Plugin\facets\widget\GlossaryAZWidget::buildConfigurationForm()
  2. 8.2 src/Plugin/facets/widget/GlossaryAZWidget.php \Drupal\search_api_glossary\Plugin\facets\widget\GlossaryAZWidget::buildConfigurationForm()
  3. 8.3 src/Plugin/facets/widget/GlossaryAZWidget.php \Drupal\search_api_glossary\Plugin\facets\widget\GlossaryAZWidget::buildConfigurationForm()

Provides a configuration form for this widget.

Parameters

array $form: A form API form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

\Drupal\facets\FacetInterface $facet: The facet entitu.

Return value

array A renderable form array.

Overrides WidgetPluginBase::buildConfigurationForm

File

src/Plugin/facets/widget/GlossaryAZWidget.php, line 130

Class

GlossaryAZWidget
The GlossaryAZ widget.

Namespace

Drupal\search_api_glossary\Plugin\facets\widget

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
  $form['show_count'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show count per Glossary item'),
  ];
  $form['enable_default_theme'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Use default Glossary AZ Theme'),
  ];
  $config = $facet
    ->getWidget()['config'];
  if (!is_null($config)) {
    if (isset($config['show_count'])) {
      $form['show_count']['#default_value'] = $config['show_count'];
    }
    if (isset($config['enable_default_theme'])) {
      $form['enable_default_theme']['#default_value'] = $config['enable_default_theme'];
    }
  }
  return $form;
}