You are here

function _syntaxhighlighter_node_validate in Syntax Highlighter 8

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

1 string reference to '_syntaxhighlighter_node_validate'
syntaxhighlighter_form_node_form_alter in ./syntaxhighlighter.module
Implements hook_form_BASE_FORM_ID_alter().

File

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

Code

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