public function FormWizardBase::populateCachedValues in Chaos Tool Suite (ctools) 8.3
Form validation handler that populates the cached values from tempstore.
Temporary values are only available for a single page load so form submission will lose all the values. This was we reload and provide them to the validate and submit process.
Parameters
array $form: Drupal form array.
\Drupal\Core\Form\FormStateInterface $form_state: The initial form state before validation or submission of the steps.
Overrides FormWizardInterface::populateCachedValues
File
- src/
Wizard/ FormWizardBase.php, line 298
Class
- FormWizardBase
- The base class for all form wizard.
Namespace
Drupal\ctools\WizardCode
public function populateCachedValues(array &$form, FormStateInterface $form_state) {
$cached_values = $this
->getTempstore()
->get($this
->getMachineName());
if (!$cached_values) {
$cached_values = $form_state
->getTemporaryValue('wizard');
if (!$cached_values) {
$cached_values = $this
->initValues();
$form_state
->setTemporaryValue('wizard', $cached_values);
}
}
}