-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.1.15
-
None
-
MOODLE_401_STABLE
Curently form elements display with the element text in a col-3 and the element itself in a col-9
This is rendered by lib/form/templates/element-template.mustache
In looking into this issue I have noticed that
lib/form/templates/element-template-inline.mustache
exists.
This inline template put the title above the element and follows the stanadrd bootstrap layout.
There seems to be no way to get the elements to actualy use this template though. There is nothing I can find in any of the documentation on enabling theme - I had expected to see some kind of flag on the fifth element.
I have posted to the moodle forums and no one there seems to know about them.
Replication steps:
- Create a moodle form
- Add a text input $mform->addelement('text','testtext', 'testtitle')
- Look at the form and notice that the text is in a col-3 down the left hand side of the form and the input is a col-9 next to it - this uses element-template.mustache for it's layout
- Read the Boostrap documentation and see that the default is inline forms ie a div with the class form-group containing the label above the input which is agurably a much better layout - long text labels don't get squished
- Poke about in Moodle core code and see that lib/form/template/element-template-inline.mustache exists which does this style of layout
- Trawl Moodle docs, Moodle forums, ChatGPT, Google searchs and core code. Completely fail to find any way to use this inline template on a form element(s)
So bug really comes down the required feature seems to already exist but nowhere actually seems to tell you how to use it