public function FilterMarkdown::settingsForm in Markdown 8.2
Generates a filter's settings form.
Parameters
array $form: A minimally prepopulated form array.
\Drupal\Core\Form\FormStateInterface $form_state: The state of the (entire) configuration form.
Return value
array The $form array with additional form elements for the settings of this filter. The submitted form values should match $this->settings.
Overrides FilterBase::settingsForm
File
- src/
Plugin/ Filter/ FilterMarkdown.php, line 271
Class
- FilterMarkdown
- Provides a filter for Markdown.
Namespace
Drupal\markdown\Plugin\FilterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
// Filter settings are nested inside "details". Due to the way the Form API
// works, any time a property is explicitly specified, the default property
// values are not included. It must be manually retrieved and set here.
$form['#process'] = $this->elementInfo
->getInfoProperty('details', '#process', []);
// Now, add the process to build the subform.
$form['#process'][] = [
$this,
'processSubform',
];
// If there's no filter format set, attempt to extract it from the form.
if (!$this->filterFormat && ($formObject = $form_state
->getFormObject()) && $formObject instanceof EntityFormInterface && ($entity = $formObject
->getEntity()) && $entity instanceof FilterFormat) {
$this
->setFilterFormat($entity);
}
return $form;
}