You are here

public function ModuleH5PAdminSettingsForm::submitForm in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/Form/ModuleH5PAdminSettingsForm.php \Drupal\opigno_module\Form\ModuleH5PAdminSettingsForm::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/ModuleH5PAdminSettingsForm.php, line 92

Class

ModuleH5PAdminSettingsForm
Class LearningPathAdminSettingsForm.

Namespace

Drupal\opigno_module\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $form_values = $form_state
    ->getValues();
  $disabled = array_filter($form_values['h5p_disabled'], function ($item) {
    if ($item !== 0) {
      return $item;
    }
  });
  $not_recommended = $this
    ->disabledByDefault();
  $config = array_merge($disabled, $not_recommended);
  $this
    ->config('opigno_module.settings')
    ->set('disabled_h5p', array_values($config))
    ->save();
}