public function ConfigureStyles::submitForm in Block Style Plugins 8.2
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
- src/
Form/ ConfigureStyles.php, line 185
Class
- ConfigureStyles
- Provides a form to configure styles.
Namespace
Drupal\block_style_plugins\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValue('settings');
if ($values) {
$this->blockStyles
->setConfiguration($values);
}
if ($this->blockStyles instanceof PluginFormInterface) {
$subform_state = SubformState::createForSubform($form['settings'], $form, $form_state);
$this
->getPluginForm($this->blockStyles)
->submitConfigurationForm($form, $subform_state);
}
$configuration = $this->blockStyles
->getConfiguration();
$plugin_id = $this->blockStyles
->getPluginId();
$component = $this
->getComponent();
$component
->setThirdPartySetting('block_style_plugins', $plugin_id, $configuration);
$this->layoutTempstoreRepository
->set($this->sectionStorage);
$form_state
->setRedirectUrl($this->sectionStorage
->getLayoutBuilderUrl());
}