public function ParserConfigurationForm::submitSubform in Markdown 8.2
Subform 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.
File
- src/
Form/ ParserConfigurationForm.php, line 717
Class
- ParserConfigurationForm
- Form for modifying parser configuration.
Namespace
Drupal\markdown\FormCode
public function submitSubform(array &$form, FormStateInterface $form_state) {
// Immediately return if no subform parents or form hasn't submitted.
if (!($arrayParents = $form_state
->get('markdownSubformArrayParents')) || !$form_state
->isSubmitted()) {
return;
}
$subform =& NestedArray::getValue($form, $arrayParents);
$subformState = SubformState::createForSubform($subform, $form, $form_state);
$parserId = $subformState
->getValue('id');
if ($parserId && $this->parserManager
->hasDefinition($parserId)) {
$parser = $this->parserManager
->createInstance($parserId, $subformState
->getValues());
if ($parser instanceof SettingsInterface && $parser instanceof PluginFormInterface && !empty($subform['parser']['settings'])) {
$parser
->submitConfigurationForm($subform['parser']['settings'], SubformState::createForSubform($subform['parser']['settings'], $subform, $subformState));
}
if ($parser instanceof ExtensibleParserInterface && !empty($subform['parser']['extensions'])) {
foreach ($parser
->extensions() as $extensionId => $extension) {
if ($extension instanceof SettingsInterface && $extension instanceof PluginFormInterface && isset($subform['parser']['extensions'][$extensionId]['settings'])) {
$parser
->submitConfigurationForm($subform['parser']['extensions'][$extensionId]['settings'], SubformState::createForSubform($subform['parser']['extensions'][$extensionId]['settings'], $subform, $subformState));
}
}
}
}
}