You are here

protected function Session::findArrayValue in Views Extras (Session/Cookie/Token Support) 8

Same name and namespace in other branches
  1. 2.x src/Plugin/views/argument_default/Session.php \Drupal\views_extras\Plugin\views\argument_default\Session::findArrayValue()

A helper function to return a value from a multidimensional array.

Parameters

array $array: The array in which key has to be found.

array $keys: The array of keys to be find in $array.

1 call to Session::findArrayValue()
Session::getArgument in src/Plugin/views/argument_default/Session.php
Return the default argument.

File

src/Plugin/views/argument_default/Session.php, line 167

Class

Session
Default argument plugin to use the raw value from the URL.

Namespace

Drupal\views_extras\Plugin\views\argument_default

Code

protected function findArrayValue(array $array, array $keys) {
  if (array_key_exists($keys[0], $array)) {
    if (is_array($array[$keys[0]])) {
      $next_key = array_shift($keys);
      if (!empty($keys)) {
        return $this
          ->findArrayValue($array[$next_key], $keys);
      }
    }
    else {
      return $array[$keys[0]];
    }
  }
  return FALSE;
}