You are here

public function SettingsForm::submitForm in Content Planner 8

Same name in this branch
  1. 8 modules/content_kanban/src/Form/SettingsForm.php \Drupal\content_kanban\Form\SettingsForm::submitForm()
  2. 8 modules/content_calendar/src/Form/SettingsForm.php \Drupal\content_calendar\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

modules/content_calendar/src/Form/SettingsForm.php, line 240

Class

SettingsForm
Defines a form that configures forms module settings.

Namespace

Drupal\content_calendar\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Get form values.
  $values = $form_state
    ->getValues();

  // Save show user image thumbnail option.
  $this
    ->config(self::CONFIG_NAME)
    ->set('show_user_thumb', $values['show_user_thumb'])
    ->set('bg_color_unpublished_content', $values['bg_color_unpublished_content'])
    ->save();

  // Get selected Content Types.
  $selected_content_types = $this
    ->getSelectedContentTypes($form_state);

  // Load config entities.
  $config_entities = $this->contentTypeConfigService
    ->loadAllEntities();

  // Check which config entity needs to be added.
  $this
    ->addNewConfigEntities($selected_content_types, $config_entities);

  // Check which config entity needs to be deleted.
  $this
    ->deleteObsoleteConfigEntities($selected_content_types, $config_entities);
}