MDL-56858 theme_boost: separate input description and label

Also added missing advanced and required form symbols.
This commit is contained in:
Mark Nelson 2016-11-24 17:23:27 +08:00
parent 3eabedbb92
commit dc801cb6b9
7 changed files with 81 additions and 12 deletions

View File

@ -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,

View File

@ -22,7 +22,11 @@
{{/element.frozen}}
{{{element.attributes}}} >
{{{label}}}
</label> {{{helpbutton}}}
</label>
{{#text}}
<em>{{{.}}}</em>
{{/text}}
{{{helpbutton}}}
<span class="form-control-feedback" id="id_error_{{element.name}}" {{^error}} style="display: none;"{{/error}}>
{{{error}}}
</span>

View File

@ -1,5 +1,12 @@
<div class="form-group row {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}">
<div class="col-md-9 push-md-3 checkbox">
<div class="col-md-3">
{{#text}}
<label for="{{element.id}}">
{{{label}}}
</label>
{{/text}}
</div>
<div class="col-md-9 checkbox">
<label>
{{^element.hardfrozen}}
{{^element.frozen}}
@ -22,8 +29,17 @@
disabled
{{/element.frozen}}
{{{element.attributes}}} >
{{{label}}}
</label> {{{helpbutton}}}
{{#text}}
{{{.}}}
{{/text}}
{{^text}}
{{{label}}}
{{/text}}
</label>
<span class="text-nowrap">
{{#advanced}}<abbr class="initialism text-info" title="{{#str}}advanced{{/str}}">❗</abbr>{{/advanced}}
{{{helpbutton}}}
</span>
<div class="form-control-feedback" id="id_error_{{element.name}}" {{^error}} style="display: none;"{{/error}}>
{{{error}}}
</div>

View File

@ -22,7 +22,11 @@
{{/element.frozen}}
{{{element.attributes}}} >
{{{label}}}
</label> {{{helpbutton}}}
</label>
{{#text}}
<em>{{{.}}}</em>
{{/text}}
{{{helpbutton}}}
<span class="form-control-feedback" id="id_error_{{element.name}}" {{^error}} style="display: none;"{{/error}}>
{{{error}}}
</span>

View File

@ -1,5 +1,12 @@
<div class="form-group row {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}">
<div class="col-md-9 push-md-3 checkbox">
<div class="col-md-3">
{{#text}}
<label for="{{element.id}}">
{{{label}}}
</label>
{{/text}}
</div>
<div class="col-md-9 checkbox">
<label>
{{^element.hardfrozen}}
{{#element.frozen}}
@ -22,8 +29,17 @@
disabled
{{/element.frozen}}
{{{element.attributes}}} >
{{{label}}}
</label> {{{helpbutton}}}
{{#text}}
{{{.}}}
{{/text}}
{{^text}}
{{{label}}}
{{/text}}
</label>
<span class="text-nowrap">
{{#advanced}}<abbr class="initialism text-info" title="{{#str}}advanced{{/str}}">❗</abbr>{{/advanced}}
{{{helpbutton}}}
</span>
<div class="form-control-feedback" id="id_error_{{element.name}}" {{^error}} style="display: none;"{{/error}}>
{{{error}}}
</div>

View File

@ -22,7 +22,11 @@
{{{element.attributes}}} >
{{/element.frozen}}
{{{label}}}
</label> {{{helpbutton}}}
</label>
{{#text}}
<em>{{{.}}}</em>
{{/text}}
{{{helpbutton}}}
<span class="form-control-feedback" id="id_error_{{element.name}}" {{^error}} style="display: none;"{{/error}}>
{{{error}}}
</span>

View File

@ -12,7 +12,14 @@
}}
<div class="form-group row {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}">
<div class="col-md-9 push-md-3 checkbox">
<div class="col-md-3">
{{#text}}
<label for="{{element.id}}">
{{{label}}}
</label>
{{/text}}
</div>
<div class="col-md-9 checkbox">
<label>
{{^element.frozen}}
<input type="radio" name="{{element.name}}"
@ -22,8 +29,18 @@
autofocus aria-describedby="id_error_{{element.name}}"
{{/error}} {{{element.attributes}}} >
{{/element.frozen}}
{{#text}}
{{{.}}}
{{/text}}
{{^text}}
{{{label}}}
</label> {{{helpbutton}}}
{{/text}}
</label>
<span class="text-nowrap">
{{#required}}<abbr class="initialism text-danger" title="{{#str}}required{{/str}}">✲</abbr>{{/required}}
{{#advanced}}<abbr class="initialism text-info" title="{{#str}}advanced{{/str}}">❗</abbr>{{/advanced}}
{{{helpbutton}}}
</span>
<div class="form-control-feedback" id="id_error_{{element.name}}" {{^error}} style="display: none;"{{/error}}>
{{{error}}}
</div>