You are here

public function ReferenceSettingsLinksForm::submitForm in Bibliography & Citation 8

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

Class

ReferenceSettingsLinksForm
Common Reference settings.

Namespace

Drupal\bibcite_entity\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('bibcite_entity.reference.settings');
  $links = $form_state
    ->getValue('links');
  array_walk($links, function (&$link) {
    $link['enabled'] = (bool) $link['enabled'];
    $link['weight'] = (int) $link['weight'];
  });
  $config
    ->set('links', $links);
  $config
    ->save();
  parent::submitForm($form, $form_state);
}