You are here

function _syntaxhighlighter_comment_validate in Syntax Highlighter 8

Same name and namespace in other branches
  1. 7.2 syntaxhighlighter.module \_syntaxhighlighter_comment_validate()
  2. 7 syntaxhighlighter.module \_syntaxhighlighter_comment_validate()

Validate the comment input text to be sure that there are no bad tags.

1 string reference to '_syntaxhighlighter_comment_validate'
syntaxhighlighter_form_comment_form_alter in ./syntaxhighlighter.module
Implements hook_form_BASE_FORM_ID_alter().

File

./syntaxhighlighter.module, line 300
Syntax highlight code using the SyntaxHighlighter Javascript library.

Code

function _syntaxhighlighter_comment_validate($form, FormStateInterface $form_state) {
  $comment_body = $form_state
    ->getValue('comment_body');
  if (isset($comment_body)) {
    $format = isset($comment_body[0]['format']) ? $comment_body[0]['format'] : filter_fallback_format();
    if (_syntaxhighlighter_format_has_syntaxhighlighter_filter($format)) {
      _syntaxhighlighter_validate_input($form_state, "comment_body][0][value", $comment_body[0]['value']);
    }
  }
}