function FilterPluginBase::exposedInfo

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::exposedInfo()
  2. 10 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::exposedInfo()
  3. 11.x core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::exposedInfo()

Tell the renderer about our exposed form.

This only needs to be overridden for particularly complex forms. And maybe not even then.

Return value

array|null For standard exposed filters. An array with the following keys:

  • operator: The $form key of the operator. Set to NULL if no operator.
  • value: The $form key of the value. Set to NULL if no value.
  • label: The label to use for this piece.

For grouped exposed filters. An array with the following keys:

  • value: The $form key of the value. Set to NULL if no value.
  • label: The label to use for this piece.

Overrides HandlerBase::exposedInfo

1 call to FilterPluginBase::exposedInfo()
FilterPluginBase::buildValueWrapper in core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
Builds wrapper for value and operator forms.

File

core/modules/views/src/Plugin/views/filter/FilterPluginBase.php, line 1357

Class

FilterPluginBase
Base class for Views filters handler plugins.

Namespace

Drupal\views\Plugin\views\filter

Code

public function exposedInfo() {
    if (empty($this->options['exposed'])) {
        return;
    }
    if ($this->isAGroup()) {
        return [
            'value' => $this->options['group_info']['identifier'],
            'label' => $this->options['group_info']['label'],
            'description' => $this->options['group_info']['description'],
        ];
    }
    return [
        'operator' => $this->options['expose']['operator_id'],
        'value' => $this->options['expose']['identifier'],
        'label' => $this->options['expose']['label'],
        'description' => $this->options['expose']['description'],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.