Skip to content
Snippets Groups Projects
Commit 365155f8 authored by snater's avatar snater
Browse files

Issue #3314446: Only set element value when element exists

parent 9b9f1c68
No related branches found
No related tags found
No related merge requests found
......@@ -858,11 +858,19 @@ function _insert_allowed_html_validate(array $element, FormStateInterface &$form
$additional = \Drupal::moduleHandler()->invokeAll('insert_allowed_html');
$form_state->setValueForElement($element, InsertUtility::addAllowedHtml(
$element['#value'],
NestedArray::mergeDeep($tags, isset($additional['tags']) ? $additional['tags'] : []),
NestedArray::mergeDeep($attributes, isset($additional['attributes']) ? $additional['attributes'] : [])
));
if (isset($element['#value'])) {
$form_state->setValueForElement($element, InsertUtility::addAllowedHtml(
$element['#value'],
NestedArray::mergeDeep(
$tags,
isset($additional['tags']) ? $additional['tags'] : []
),
NestedArray::mergeDeep(
$attributes,
isset($additional['attributes']) ? $additional['attributes'] : []
)
));
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment