You are here

public function SelectOtherFilter::init in CCK Select Other 8

Overrides \Drupal\views\Plugin\views\HandlerBase::init().

Provide some extra help to get the operator/value easier to use.

This likely has to be overridden by filters which are more complex than simple operator/value.

Overrides ListField::init

File

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

Class

SelectOtherFilter
Select other filter handler.

Namespace

Drupal\cck_select_other\Plugin\views\filter

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);

  /** @var \Drupal\Core\Field\FieldDefinitionInterface $instance */
  $this->instance = $this
    ->getFieldDefinition();
  $settings = $this
    ->getWidgetSettings($this->instance);
  if ($settings) {
    $this->valueOptions['other'] = isset($settings['other_label']) ? $settings['other_label'] : $this
      ->t('Other');
  }
}