You are here

public function LayoutParagraphsSettingsForm::submitForm in Layout Paragraphs 1.0.x

Same name and namespace in other branches
  1. 2.0.x src/Form/LayoutParagraphsSettingsForm.php \Drupal\layout_paragraphs\Form\LayoutParagraphsSettingsForm::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/LayoutParagraphsSettingsForm.php, line 93

Class

LayoutParagraphsSettingsForm
Class LayoutParagraphsSettingsForm.

Namespace

Drupal\layout_paragraphs\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $lp_config = $this
    ->configFactory()
    ->getEditable('layout_paragraphs.settings');
  $lp_config
    ->set('show_paragraph_labels', $form_state
    ->getValue('show_paragraph_labels'));
  $lp_config
    ->set('show_layout_labels', $form_state
    ->getValue('show_layout_labels'));
  $lp_config
    ->save();

  // Confirmation on form submission.
  $this
    ->messenger()
    ->addMessage($this
    ->t('The Layout Paragraphs settings have been saved.'));
}