You are here

public function CshsTaxonomyIndex::valueForm in Client-side Hierarchical Select 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/filter/CshsTaxonomyIndex.php \Drupal\cshs\Plugin\views\filter\CshsTaxonomyIndex::valueForm()
  2. 8 src/Plugin/views/filter/CshsTaxonomyIndex.php \Drupal\cshs\Plugin\views\filter\CshsTaxonomyIndex::valueForm()

File

src/Plugin/views/filter/CshsTaxonomyIndex.php, line 82

Class

CshsTaxonomyIndex
Common implementation for "CshsTaxonomyIndex" plugin.

Namespace

Drupal\cshs\Plugin\views\filter

Code

public function valueForm(&$form, FormStateInterface $form_state) : void {
  parent::valueForm($form, $form_state);
  if ($this->options['limit'] && $this
    ->getVocabulary() === NULL) {
    $form['markup'] = [
      '#type' => 'item',
      '#markup' => $this
        ->t('An invalid vocabulary is selected. Please change it in the options.'),
    ];
  }
  elseif (CshsElement::ID === $this->options['type']) {
    $form['value'] = \array_merge($form['value'], $this
      ->formElement(), [
      '#multiple' => FALSE,
      '#default_value' => (array) $form['value']['#default_value'],
    ]);
  }
}