function FormStateValuesTrait::getValue

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Form/FormStateValuesTrait.php \Drupal\Core\Form\FormStateValuesTrait::getValue()
  2. 8.9.x core/lib/Drupal/Core/Form/FormStateValuesTrait.php \Drupal\Core\Form\FormStateValuesTrait::getValue()
  3. 10 core/lib/Drupal/Core/Form/FormStateValuesTrait.php \Drupal\Core\Form\FormStateValuesTrait::getValue()

Implements \Drupal\Core\Form\FormStateInterface::getValue()

File

core/lib/Drupal/Core/Form/FormStateValuesTrait.php, line 24

Class

FormStateValuesTrait
Provides methods to manage form state values.

Namespace

Drupal\Core\Form

Code

public function &getValue($key, $default = NULL) {
    $exists = NULL;
    $value =& NestedArray::getValue($this->getValues(), (array) $key, $exists);
    if (!$exists) {
        $value = $default;
    }
    return $value;
}

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