protected function ParserConfigurationForm::buildParserSettings in Markdown 8.2
Builds the settings for a specific parser.
Parameters
\Drupal\markdown\Plugin\Markdown\ParserInterface $parser: The parser.
array $element: An element in a render array.
\Drupal\markdown\Form\SubformStateInterface $form_state: The form state.
Return value
array The $element passed, modified to include the parser settings element.
1 call to ParserConfigurationForm::buildParserSettings()
- ParserConfigurationForm::buildParser in src/
Form/ ParserConfigurationForm.php - Builds the parser form elements.
File
- src/
Form/ ParserConfigurationForm.php, line 325
Class
- ParserConfigurationForm
- Form for modifying parser configuration.
Namespace
Drupal\markdown\FormCode
protected function buildParserSettings(ParserInterface $parser, array $element, SubformStateInterface $form_state) {
$element['settings'] = [
'#type' => 'details',
'#title' => $this
->t('Settings'),
'#open' => TRUE,
];
if ($parser instanceof PluginFormInterface) {
$parserSettingsSubform = SubformState::createForSubform($element['settings'], $element, $form_state);
$element['settings'] = $parser
->buildConfigurationForm($element['settings'], $parserSettingsSubform);
}
// If there are no visible settings, add a description so the user knows
// that is the case and not left with an empty container.
if (!Element::getVisibleChildren($element['settings'])) {
$element['settings']['#description'] = $this
->t('This parser has no settings to configure.');
}
return $element;
}