public function OverviewForm::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 ConfigFormBase::submitForm
File
- src/
Form/ OverviewForm.php, line 358
Class
Namespace
Drupal\markdown\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$invalidateCacheTags = [];
if ($weights = $form_state
->getValue('weights')) {
asort($weights, SORT_NUMERIC);
// Reset weights so they start at 0.
$i = 0;
foreach (array_keys($weights) as $name) {
$configName = "markdown.parser.{$name}";
$config = $this
->config($configName);
if ($config
->get('weight') !== $i) {
$config
->set('weight', $i)
->save();
$invalidateCacheTags[] = $configName;
}
$i++;
}
}
$this->parserManager
->clearCachedDefinitions();
if ($invalidateCacheTags) {
$this->cacheTagsInvalidator
->invalidateTags($invalidateCacheTags);
}
parent::submitForm($form, $form_state);
}