You are here

function FilterPluginBase::store_group_input in Views (for Drupal 7) 8.3

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

lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php, line 1229
Definition of Drupal\views\Plugin\views\filter\FilterPluginBase.

Class

FilterPluginBase
Base class for filters.

Namespace

Drupal\views\Plugin\views\filter

Code

function store_group_input($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 recuse ourselves,
  // so we should erase whatever happened to be there.
  if ($status === FALSE && isset($_SESSION['views'][$this->view->storage->name][$display_id])) {
    $session =& $_SESSION['views'][$this->view->storage->name][$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->name][$display_id])) {
      $_SESSION['views'][$this->view->storage->name][$display_id] = array();
    }
    $session =& $_SESSION['views'][$this->view->storage->name][$display_id];
    $session[$this->options['group_info']['identifier']] = $input[$this->options['group_info']['identifier']];
  }
}