You are here

public function ParserConfigurationForm::submitForm in Markdown 8.2

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

src/Form/ParserConfigurationForm.php, line 690

Class

ParserConfigurationForm
Form for modifying parser configuration.

Namespace

Drupal\markdown\Form

Code

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

  // Extract the values from the form.
  $values = $form_state
    ->cleanValues()
    ->getValues();

  // Determine the parser identifier.
  $parserId = isset($values['id']) ? (string) $values['id'] : $this
    ->getParser()
    ->getOriginalPluginId();

  // Normalize parser values into config data.
  $config = $this
    ->getConfigFromValues("markdown.parser.{$parserId}", $values);

  // Save the config.
  $config
    ->save();

  // Invalidate any tags associated with the parser.
  $this->cacheTagsInvalidator
    ->invalidateTags([
    "markdown.parser.{$parserId}",
  ]);
  drupal_set_message($this
    ->t('The configuration options have been saved.'));
}