function FilterPluginBase::storeGroupInput
Same name in other branches
- 9 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::storeGroupInput()
- 10 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::storeGroupInput()
- 11.x core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::storeGroupInput()
If set to remember exposed input in the session, store it there. This function is similar to storeExposedInput but modified to work properly when the filter is a group.
File
-
core/
modules/ views/ src/ Plugin/ views/ filter/ FilterPluginBase.php, line 1388
Class
- FilterPluginBase
- Base class for Views filters handler plugins.
Namespace
Drupal\views\Plugin\views\filterCode
public function storeGroupInput($input, $status) {
if (!$this->isAGroup() || empty($this->options['group_info']['identifier'])) {
return TRUE;
}
if (empty($this->options['group_info']['remember'])) {
return;
}
// Figure out which display id is responsible for the filters, so we
// know where to look for session stored values.
$display_id = $this->view->display_handler
->isDefaulted('filters') ? 'default' : $this->view->current_display;
// False means that we got a setting that means to recurse ourselves,
// so we should erase whatever happened to be there.
if ($status === FALSE && isset($_SESSION['views'][$this->view->storage
->id()][$display_id])) {
$session =& $_SESSION['views'][$this->view->storage
->id()][$display_id];
if (isset($session[$this->options['group_info']['identifier']])) {
unset($session[$this->options['group_info']['identifier']]);
}
}
if ($status !== FALSE) {
if (!isset($_SESSION['views'][$this->view->storage
->id()][$display_id])) {
$_SESSION['views'][$this->view->storage
->id()][$display_id] = [];
}
$session =& $_SESSION['views'][$this->view->storage
->id()][$display_id];
$session[$this->options['group_info']['identifier']] = $input[$this->options['group_info']['identifier']];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.