You are here

public function FootnoteExtension::validateConfigurationForm in Markdown 8.2

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides SettingsTrait::validateConfigurationForm

File

src/Plugin/Markdown/CommonMark/Extension/FootnoteExtension.php, line 200

Class

FootnoteExtension
Footnotes extension.

Namespace

Drupal\markdown\Plugin\Markdown\CommonMark\Extension

Code

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

  /** @var \Drupal\markdown\Form\SubformStateInterface $form_state */
  foreach ([
    'footnote_id_prefix',
    'ref_id_prefix',
  ] as $name) {
    if (strpos($form_state
      ->getValue($name), ':') !== FALSE) {
      $form_state
        ->setError($form[$name], $this
        ->moreInfo($this
        ->t('Due to a core bug, the use of colons (:) in "@title" is not possible.', [
        '@title' => isset($form[$name]['#title']) ? $form[$name]['#title'] : $name,
      ]), 'https://www.drupal.org/project/drupal/issues/2544110'));
    }
  }
}