X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fincludes%2Fform.inc;h=dacae875bdeb2b58b0c067f3a00c0187a3a399b3;hb=f3baf763d342a5f82576890e2a8111a5aaf139dc;hp=d99dca282a2177d47f1aac7c0826de2ccd312de8;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/includes/form.inc b/web/core/includes/form.inc index d99dca282..dacae875b 100644 --- a/web/core/includes/form.inc +++ b/web/core/includes/form.inc @@ -235,13 +235,13 @@ function template_preprocess_fieldset(&$variables) { * @param array $variables * An associative array containing: * - element: An associative array containing the properties of the element. - * Properties used: #attributes, #children, #open, - * #description, #id, #title, #value, #optional. + * Properties used: #attributes, #children, #description, #required, + * #summary_attributes, #title, #value. */ function template_preprocess_details(&$variables) { $element = $variables['element']; $variables['attributes'] = $element['#attributes']; - $variables['summary_attributes'] = new Attribute(); + $variables['summary_attributes'] = new Attribute($element['#summary_attributes']); if (!empty($element['#title'])) { $variables['summary_attributes']['role'] = 'button'; if (!empty($element['#attributes']['id'])) { @@ -251,6 +251,11 @@ function template_preprocess_details(&$variables) { $variables['summary_attributes']['aria-pressed'] = $variables['summary_attributes']['aria-expanded']; } $variables['title'] = (!empty($element['#title'])) ? $element['#title'] : ''; + // If the element title is a string, wrap it a render array so that markup + // will not be escaped (but XSS-filtered). + if (is_string($variables['title']) && $variables['title'] !== '') { + $variables['title'] = ['#markup' => $variables['title']]; + } $variables['description'] = (!empty($element['#description'])) ? $element['#description'] : ''; $variables['children'] = (isset($element['#children'])) ? $element['#children'] : ''; $variables['value'] = (isset($element['#value'])) ? $element['#value'] : ''; @@ -639,7 +644,7 @@ function template_preprocess_form_element_label(&$variables) { * else { * $message = t('Finished with an error.'); * } - * drupal_set_message($message); + * \Drupal::messenger()->addMessage($message); * // Providing data for the redirected page is done through $_SESSION. * foreach ($results as $result) { * $items[] = t('Loaded node %title.', array('%title' => $result));