You are here

public function FormState::setValue in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Form/FormState.php \Drupal\Core\Form\FormState::setValue()

Sets the submitted form value for a specific key.

Parameters

string|array $key: Values are stored as a multi-dimensional associative array. If $key is a string, it will use $values[$key] = $value. If $key is an array, each element of the array will be used as a nested key. If $key = array('foo', 'bar') it will use $values['foo']['bar'] = $value.

mixed $value: The value to set.

Return value

$this

Overrides FormStateInterface::setValue

1 call to FormState::setValue()
FormState::setValueForElement in core/lib/Drupal/Core/Form/FormState.php
Changes submitted form values during form validation.

File

core/lib/Drupal/Core/Form/FormState.php, line 1009
Contains \Drupal\Core\Form\FormState.

Class

FormState
Stores information about the state of a form.

Namespace

Drupal\Core\Form

Code

public function setValue($key, $value) {
  NestedArray::setValue($this
    ->getValues(), (array) $key, $value, TRUE);
  return $this;
}