MDL-82996 customfield_number: Show 'Display format' label as header

Display format now has its own section and we maintain the conditional
display of fields depending on the value selected in the Field type of
the Number field settings section.
This commit is contained in:
Pedro Jordao
2025-08-01 09:40:07 -03:00
parent 20bb0b2429
commit e8da3af3f4
3 changed files with 3 additions and 5 deletions
@@ -76,9 +76,8 @@ class field_controller extends \core_customfield\field_controller {
$mform->setType('configdata[decimalplaces]', PARAM_INT);
// Display format settings.
// TODO: Change this after MDL-85825 fixed.
$randelname = 'str_display_format';
$mform->addGroup([], $randelname, html_writer::tag('h4', get_string('headerdisplaysettings', 'customfield_number')));
$mform->addElement('header', 'displayformatheader', get_string('headerdisplaysettings', 'customfield_number'));
$mform->setExpanded('displayformatheader');
// Display template.
$mform->addElement('text', 'configdata[display]', get_string('display', 'customfield_number'),
@@ -71,7 +71,6 @@ class nofactivities extends provider_base {
$mform->hideIf('configdata[activitytypes]', 'configdata[fieldtype]', 'ne', get_class($this));
$mform->hideIf('configdata[decimalplaces]', 'configdata[fieldtype]', 'eq', get_class($this));
$mform->hideIf('configdata[display]', 'configdata[fieldtype]', 'eq', get_class($this));
$mform->hideIf('str_display_format', 'configdata[fieldtype]', 'eq', get_class($this));
$mform->hideIf('configdata[defaultvalue]', 'configdata[fieldtype]', 'eq', get_class($this));
$mform->hideIf('configdata[minimumvalue]', 'configdata[fieldtype]', 'eq', get_class($this));
$mform->hideIf('configdata[maximumvalue]', 'configdata[fieldtype]', 'eq', get_class($this));
@@ -112,7 +112,7 @@ Feature: Managers can manage course custom fields number
And I should not see "Minimum value"
And I should not see "Maximum value"
And I should not see "Decimal places"
And I should not see "Display format"
And I should see "Display format"
And I should not see "Display template"
And I should see "Display when zero"
And I should not see "Display when empty"