function State::get

Same name in other branches
  1. 9 core/lib/Drupal/Core/State/State.php \Drupal\Core\State\State::get()
  2. 10 core/lib/Drupal/Core/State/State.php \Drupal\Core\State\State::get()
  3. 11.x core/lib/Drupal/Core/State/State.php \Drupal\Core\State\State::get()

Overrides StateInterface::get

File

core/lib/Drupal/Core/State/State.php, line 39

Class

State
Provides the state system using a key value store.

Namespace

Drupal\Core\State

Code

public function get($key, $default = NULL) {
    $values = $this->getMultiple([
        $key,
    ]);
    return isset($values[$key]) ? $values[$key] : $default;
}

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