You are here

public function StylesForm::submitForm in Layout Builder Blocks 1.0.x

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 StylesFilterConfigForm::submitForm

File

src/Form/StylesForm.php, line 118

Class

StylesForm
Configure layout builder blocks styles.

Namespace

Drupal\layout_builder_blocks\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $blockRestrictions = $form_state
    ->getValue('block_restrictions');
  $blockRestrictions = array_keys(array_filter($blockRestrictions));
  $config = $this->configFactory
    ->getEditable(static::CONFIG);
  $config
    ->set('block_restrictions', $blockRestrictions);
  $config
    ->save();
}