public function VariantPluginContentForm::submitForm in Page Manager 8
Same name and namespace in other branches
- 8.4 page_manager_ui/src/Form/VariantPluginContentForm.php \Drupal\page_manager_ui\Form\VariantPluginContentForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- page_manager_ui/
src/ Form/ VariantPluginContentForm.php, line 240 - Contains Drupal\page_manager_ui\Form\VariantPluginContentForm.
Class
- VariantPluginContentForm
- Provides a form for editing a variant.
Namespace
Drupal\page_manager_ui\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$cached_values = $form_state
->getTemporaryValue('wizard');
/** @var \Drupal\page_manager\Plugin\DisplayVariant\PageBlockDisplayVariant $variant_plugin */
$variant_plugin = $cached_values['plugin'];
// If the blocks were rearranged, update their values.
if (!$form_state
->isValueEmpty('blocks')) {
foreach ($form_state
->getValue('blocks') as $block_id => $block_values) {
$variant_plugin
->updateBlock($block_id, $block_values);
}
}
// Remove from the tempstore so we refresh from the database the next time
// we come here.
$this
->getTempstore()
->delete($variant_plugin
->id());
}