You are here

public function SettingsForm::submitForm in Lightning Layout 8

Same name and namespace in other branches
  1. 8.2 src/Form/SettingsForm.php \Drupal\lightning_layout\Form\SettingsForm::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 ConfigFormBase::submitForm

File

src/Form/SettingsForm.php, line 137

Class

SettingsForm
The settings form for controlling Lightning Layout's behavior.

Namespace

Drupal\lightning_layout\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $value = $form_state
    ->getValue('entity_blocks');

  // Filter out unselected entity types.
  $value = array_filter($value);

  // Re-key the array.
  $value = array_values($value);
  $this
    ->config('lightning_layout.settings')
    ->set('entity_blocks', $value)
    ->save();
  $this->blockManager
    ->clearCachedDefinitions();
  parent::submitForm($form, $form_state);
}