MDL-74713 admin: format custom profile fields in identify config.

This commit is contained in:
Paul Holden 2022-05-10 08:26:47 +01:00
parent ca583bddaf
commit e0b0908ba9
3 changed files with 17 additions and 2 deletions

View File

@ -240,7 +240,8 @@ if ($hassiteconfig
if ($field->param2 > 255 || $field->datatype != 'text') {
continue;
}
$fields['profile_field_' . $field->shortname] = $field->name . ' *';
$fields['profile_field_' . $field->shortname] = format_string($field->name, true,
['context' => context_system::instance()]) . ' *';
}
return $fields;

View File

@ -117,7 +117,8 @@ class award_criteria_profile extends award_criteria {
if (in_array($field->id, $existing)) {
$checked = true;
}
$this->config_options($mform, array('id' => $field->id, 'checked' => $checked, 'name' => $field->name, 'error' => false));
$this->config_options($mform, array('id' => $field->id, 'checked' => $checked,
'name' => format_string($field->name), 'error' => false));
$none = false;
}
}

View File

@ -32,6 +32,19 @@ Feature: Select user identity fields
And I press "Save changes"
And the field "Speciality" matches value "1"
Scenario: The admin settings screen correctly formats custom field names
Given the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And the following "custom profile field" exists:
| datatype | text |
| name | <span class="multilang" lang="en">Field (EN)</span><span class="multilang" lang="de">Field (DE)</span> |
| shortname | stuff |
| param2 | 100 |
When I log in as "admin"
And I navigate to "Users > Permissions > User policies" in site administration
Then I should see "Field (EN)" in the "#admin-showuseridentity" "css_element"
And I should not see "Field (DE)" in the "#admin-showuseridentity" "css_element"
Scenario: When you choose custom fields, these should be displayed in the 'Browse list of users' screen
Given the following config values are set as admin:
| showuseridentity | username,department,profile_field_speciality |