You are here

public function CommonMark::validateConfigurationForm in Markdown 8.2

Overrides SettingsTrait::validateConfigurationForm

File

src/Plugin/Markdown/CommonMark/CommonMark.php, line 475

Class

CommonMark
Support for CommonMark by The League of Extraordinary Packages.

Namespace

Drupal\markdown\Plugin\Markdown\CommonMark

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  if ($unorderedListMarkers = $form_state
    ->getValue('unordered_list_markers')) {
    $unorderedListMarkers = KeyValuePipeConverter::normalize($unorderedListMarkers);
    foreach ($unorderedListMarkers as $marker) {
      if (strlen($marker) > 1) {
        $form_state
          ->setError($form['unordered_list_markers'], $this
          ->t('The Unordered List Markers must be only one character per line.'));
      }
    }
  }
}