Moodle

Add group name to rendered elements for better CSS control

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 1.8, 1.9
  • Fix Version/s: None
  • Component/s: Forms Library
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

If we add the group name to the rendered tags of the groups elements (<div> & <fieldset>), developers can have more control over the display through CSS.

My suggestion is to change line 1399 in formslib.php as follows:

'fieldset'=>"\n\t\t".'<div id="{name}div" class="fitem {advanced}<Unable to render embedded object: File (-- BEGIN required --> required<) not found.-- END required -->"><div class="fitemtitle"><div class="fgrouplabel">{label}<!-- BEGIN required -->{req} <!-- END required -->{advancedimg}</div>{help}</div><fieldset id="{name}fs" class="felement {type} <Unable to render embedded object: File (-- BEGIN error --> error<) not found.-- END error ->"><!- BEGIN error --><span class="error">{error}</span><br /><!-- END error -->{element}</fieldset></div>',

This adds the "id" attribute to the containing div and fieldset tags, using the name of the group. Alternatively, the name could be used in the class list if the "id" in not desired.

Issue Links

Activity

Hide
Tim Hunt added a comment -

Oops, I may just have made a duplicate: MDL-30204. I was confused by the word 'group' in the summary.

Putting name in id won't work, because our names may contain invalid characters like [].

Show
Tim Hunt added a comment - Oops, I may just have made a duplicate: MDL-30204. I was confused by the word 'group' in the summary. Putting name in id won't work, because our names may contain invalid characters like [].
Hide
Tim Hunt added a comment -

Now it seems that Anthony F has also made a duplicate! MDL-31445. This really must be a good idea.

Show
Tim Hunt added a comment - Now it seems that Anthony F has also made a duplicate! MDL-31445. This really must be a good idea.

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: