You are here

public function MappingForm::submitForm in Bibliography & Citation 8

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

File

modules/bibcite_entity/src/Form/MappingForm.php, line 190

Class

MappingForm
Format mapping form.

Namespace

Drupal\bibcite_entity\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $types = array_map(function ($type_values) {
    return $type_values['entity'];
  }, $form_state
    ->getValue('types'));
  $this->config
    ->set('types', $types);
  $fields = array_map(function ($field_values) {
    return $field_values['entity'];
  }, $form_state
    ->getValue('fields'));
  $this->config
    ->set('fields', $fields);
  $this->config
    ->save();
  $this
    ->messenger()
    ->addStatus($this
    ->t('Your mapping has been saved.'));
}