public static function WebformHtmlEditor::validateWebformHtmlEditor in Webform 8.5
Same name and namespace in other branches
- 6.x src/Element/WebformHtmlEditor.php \Drupal\webform\Element\WebformHtmlEditor::validateWebformHtmlEditor()
Webform element validation handler for #type 'webform_html_editor'.
File
- src/
Element/ WebformHtmlEditor.php, line 162
Class
- WebformHtmlEditor
- Provides a webform element for entering HTML using CodeMirror, TextFormat, or custom CKEditor.
Namespace
Drupal\webform\ElementCode
public static function validateWebformHtmlEditor(&$element, FormStateInterface $form_state, &$complete_form) {
$value = $element['#value']['value'];
if (is_array($value)) {
// Get value from TextFormat element.
$value = $value['value'];
}
else {
$value = trim($value);
}
$element['#value'] = $value;
$form_state
->setValueForElement($element, $value);
}