function PluginBase::doFilterByDefinedOptions

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

Do the work to filter out stored options depending on the defined options.

Parameters

array $storage: The stored options.

array $options: The defined options.

1 call to PluginBase::doFilterByDefinedOptions()
PluginBase::filterByDefinedOptions in core/modules/views/src/Plugin/views/PluginBase.php
Filter out stored options depending on the defined options.

File

core/modules/views/src/Plugin/views/PluginBase.php, line 207

Class

PluginBase
Base class for any views plugin types.

Namespace

Drupal\views\Plugin\views

Code

protected function doFilterByDefinedOptions(array &$storage, array $options) {
    foreach ($storage as $key => $sub_storage) {
        if (!isset($options[$key])) {
            unset($storage[$key]);
        }
        if (isset($options[$key]['contains'])) {
            $this->doFilterByDefinedOptions($storage[$key], $options[$key]['contains']);
        }
    }
}

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