You are here

protected function FontYourFaceStyleFilter::valueForm in @font-your-face 8.3

Provide a simple textfield for equality

Overrides StringFilter::valueForm

File

src/Plugin/views/filter/FontYourFaceStyleFilter.php, line 41

Class

FontYourFaceStyleFilter
Filter handler which allows to search based on font styles.

Namespace

Drupal\fontyourface\Plugin\views\filter

Code

protected function valueForm(&$form, FormStateInterface $form_state) {
  $options = [
    'All' => '- Any -',
    'normal' => $this
      ->t('Normal'),
    'italic' => $this
      ->t('Italics'),
  ];
  $form['value'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Font Style'),
    '#options' => $options,
    '#default_value' => $this->value,
  ];
  if ($exposed = $form_state
    ->get('exposed')) {
    $identifier = $this->options['expose']['identifier'];
    $user_input = $form_state
      ->getUserInput();
    if (!isset($user_input[$identifier])) {
      $user_input[$identifier] = $this->value;
      $form_state
        ->setUserInput($user_input);
    }
  }
}