From dc801cb6b9761fb631eb9846f3423298b3d89bfa Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 24 Nov 2016 17:23:27 +0800 Subject: [PATCH] MDL-56858 theme_boost: separate input description and label Also added missing advanced and required form symbols. --- lib/outputrenderers.php | 10 ++++++++- .../element-advcheckbox-inline.mustache | 6 ++++- .../core_form/element-advcheckbox.mustache | 22 ++++++++++++++++--- .../element-checkbox-inline.mustache | 6 ++++- .../core_form/element-checkbox.mustache | 22 ++++++++++++++++--- .../core_form/element-radio-inline.mustache | 6 ++++- .../core_form/element-radio.mustache | 21 ++++++++++++++++-- 7 files changed, 81 insertions(+), 12 deletions(-) diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index ec3aa463e65..56f38c6e4de 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -4374,13 +4374,21 @@ EOD; $helpbutton = $element->getHelpButton(); } $label = $element->getLabel(); + $text = ''; if (method_exists($element, 'getText')) { - $label .= ' ' . $element->getText(); + // There currently exists code that adds a form element with an empty label. + // If this is the case then set the label to the description. + if (empty($label)) { + $label = $element->getText(); + } else { + $text = $element->getText(); + } } $context = array( 'element' => $elementcontext, 'label' => $label, + 'text' => $text, 'required' => $required, 'advanced' => $advanced, 'helpbutton' => $helpbutton, diff --git a/theme/boost/templates/core_form/element-advcheckbox-inline.mustache b/theme/boost/templates/core_form/element-advcheckbox-inline.mustache index d38eab8c3d6..918f272be0d 100644 --- a/theme/boost/templates/core_form/element-advcheckbox-inline.mustache +++ b/theme/boost/templates/core_form/element-advcheckbox-inline.mustache @@ -22,7 +22,11 @@ {{/element.frozen}} {{{element.attributes}}} > {{{label}}} - {{{helpbutton}}} + +{{#text}} + {{{.}}} +{{/text}} +{{{helpbutton}}} diff --git a/theme/boost/templates/core_form/element-advcheckbox.mustache b/theme/boost/templates/core_form/element-advcheckbox.mustache index d94e26fe067..8ceb89a6e5d 100644 --- a/theme/boost/templates/core_form/element-advcheckbox.mustache +++ b/theme/boost/templates/core_form/element-advcheckbox.mustache @@ -1,5 +1,12 @@
-
+
+ {{#text}} + + {{/text}} +
+
{{{helpbutton}}} + {{#text}} + {{{.}}} + {{/text}} + {{^text}} + {{{label}}} + {{/text}} + + + {{#advanced}}❗{{/advanced}} + {{{helpbutton}}} + diff --git a/theme/boost/templates/core_form/element-checkbox-inline.mustache b/theme/boost/templates/core_form/element-checkbox-inline.mustache index a3c87258f9f..8e098f049fc 100644 --- a/theme/boost/templates/core_form/element-checkbox-inline.mustache +++ b/theme/boost/templates/core_form/element-checkbox-inline.mustache @@ -22,7 +22,11 @@ {{/element.frozen}} {{{element.attributes}}} > {{{label}}} - {{{helpbutton}}} + +{{#text}} + {{{.}}} +{{/text}} +{{{helpbutton}}} diff --git a/theme/boost/templates/core_form/element-checkbox.mustache b/theme/boost/templates/core_form/element-checkbox.mustache index cd3f5b88d99..856c4d6152f 100644 --- a/theme/boost/templates/core_form/element-checkbox.mustache +++ b/theme/boost/templates/core_form/element-checkbox.mustache @@ -1,5 +1,12 @@
-
+
+ {{#text}} + + {{/text}} +
+
{{{helpbutton}}} + {{#text}} + {{{.}}} + {{/text}} + {{^text}} + {{{label}}} + {{/text}} + + + {{#advanced}}❗{{/advanced}} + {{{helpbutton}}} + diff --git a/theme/boost/templates/core_form/element-radio-inline.mustache b/theme/boost/templates/core_form/element-radio-inline.mustache index 509c6d76e92..2682d3c6d5e 100644 --- a/theme/boost/templates/core_form/element-radio-inline.mustache +++ b/theme/boost/templates/core_form/element-radio-inline.mustache @@ -22,7 +22,11 @@ {{{element.attributes}}} > {{/element.frozen}} {{{label}}} - {{{helpbutton}}} + +{{#text}} + {{{.}}} +{{/text}} +{{{helpbutton}}} diff --git a/theme/boost/templates/core_form/element-radio.mustache b/theme/boost/templates/core_form/element-radio.mustache index 7a64ad5f8ad..c130b725d60 100644 --- a/theme/boost/templates/core_form/element-radio.mustache +++ b/theme/boost/templates/core_form/element-radio.mustache @@ -12,7 +12,14 @@ }}
-
+
+ {{#text}} + + {{/text}} +
+
{{{helpbutton}}} + {{/text}} + + + {{#required}}✲{{/required}} + {{#advanced}}❗{{/advanced}} + {{{helpbutton}}} +