MDL-59749 form: revert setting id on inline form elements
authorRyan Wyllie <ryan@moodle.com>
Tue, 8 Aug 2017 03:28:36 +0000 (03:28 +0000)
committerRyan Wyllie <ryan@moodle.com>
Tue, 8 Aug 2017 03:28:36 +0000 (03:28 +0000)
Revert the change I made in MDL-59382 to correctly set the id for inline
form elements because it's breaking a bunch of different places that had
already worked around the problem.

lib/form/templatable_form_element.php
theme/boost/templates/core_form/element-template-inline.mustache

index beb7173..7d8c2ab 100644 (file)
@@ -78,7 +78,6 @@ trait templatable_form_element {
                 $otherattributes[] = $attr . '="' . s($value) . '"';
             }
         }
-        $context['name'] = $context['name'] ?: $this->getName();
         $context['extraclasses'] = $extraclasses;
         $context['type'] = $this->getType();
         $context['attributes'] = implode(' ', $otherattributes);
index 55e16c5..88593fc 100644 (file)
@@ -4,7 +4,7 @@
         {{#required}}<abbr class="initialism text-danger" title="{{#str}}required{{/str}}">{{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}</abbr>{{/required}}
         {{#advanced}}<abbr class="initialism text-info" title="{{#str}}advanced{{/str}}">!</abbr>{{/advanced}}
     </label>
-    <span id="{{element.id}}" data-fieldtype="{{element.type}}">
+    <span data-fieldtype="{{element.type}}">
         {{$ element }}
             <!-- Element goes here -->
         {{/ element }}