You are here

public function EntityReferenceLayoutSettingsForm::submitForm in Entity Reference with Layout 8

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/EntityReferenceLayoutSettingsForm.php, line 93

Class

EntityReferenceLayoutSettingsForm
Class EntityReferenceLayoutSettingsForm.

Namespace

Drupal\entity_reference_layout\Form

Code

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

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