Skip to content
Snippets Groups Projects
Commit fcde99a4 authored by Steven Wittens's avatar Steven Wittens
Browse files

#60916: Fix comment subject being empty when comment only contains HTML tags.

parent 46104998
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -1546,8 +1546,14 @@ function _comment_form_submit($form_values) {
// 2) Strip out all HTML tags
// 3) Convert entities back to plain-text.
// Note: format is checked by check_markup().
$form_values['subject'] = truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE);
$form_values['subject'] = trim(truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE));
// Edge cases where the comment body is populated only by HTML tags will
// require a default subject.
if ($form_values['subject'] == '') {
$form_values['subject'] = t('(No subject)');
}
}
return $form_values;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment