You are here

protected function BetterExposedFiltersWidgetBase::addContext in Better Exposed Filters 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/BetterExposedFiltersWidgetBase.php \Drupal\better_exposed_filters\Plugin\BetterExposedFiltersWidgetBase::addContext()

Sets metadata on the form elements for easier processing.

Parameters

array $element: The form element to apply the metadata to.

See also

://www.drupal.org/project/drupal/issues/2511548

3 calls to BetterExposedFiltersWidgetBase::addContext()
FilterWidgetBase::exposedFormAlter in src/Plugin/better_exposed_filters/filter/FilterWidgetBase.php
Manipulate views exposed from element.
PagerWidgetBase::exposedFormAlter in src/Plugin/better_exposed_filters/pager/PagerWidgetBase.php
Manipulate views exposed from element.
SortWidgetBase::exposedFormAlter in src/Plugin/better_exposed_filters/sort/SortWidgetBase.php
Manipulate views exposed from element.

File

src/Plugin/BetterExposedFiltersWidgetBase.php, line 116

Class

BetterExposedFiltersWidgetBase
Base class for Better exposed filters widget plugins.

Namespace

Drupal\better_exposed_filters\Plugin

Code

protected function addContext(array &$element) {
  $element['#context'] = [
    '#plugin_type' => 'bef',
    '#plugin_id' => $this->pluginId,
    '#view_id' => $this->view
      ->id(),
    '#display_id' => $this->view->current_display,
  ];
}