MDL-82488 customfield: allow for unescaped field formatted names.
Resolves double encoding of the same in Report builder editor.
This commit is contained in:
@@ -255,11 +255,15 @@ abstract class field_controller {
|
||||
/**
|
||||
* Returns the field name formatted according to configuration context.
|
||||
*
|
||||
* @param bool $escape
|
||||
* @return string
|
||||
*/
|
||||
public function get_formatted_name(): string {
|
||||
public function get_formatted_name(bool $escape = true): string {
|
||||
$context = $this->get_handler()->get_configuration_context();
|
||||
return format_string($this->get('name'), true, ['context' => $context]);
|
||||
return format_string($this->get('name'), true, [
|
||||
'context' => $context,
|
||||
'escape' => $escape,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
This files describes API changes in /customfield/*,
|
||||
Information provided here is intended especially for developers.
|
||||
|
||||
=== 4.4.4 ===
|
||||
* The field controller `get_formatted_name()` method now accepts an optional `$escape` parameter to define whether to
|
||||
escape the returned name
|
||||
|
||||
=== 4.4.2 ===
|
||||
* The customfield_select field controller `get_options` method now returns each option pre-formatted
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ class custom_fields {
|
||||
|
||||
$columns[] = (new column(
|
||||
'customfield_' . $field->get('shortname'),
|
||||
new lang_string('customfieldcolumn', 'core_reportbuilder', $field->get_formatted_name()),
|
||||
new lang_string('customfieldcolumn', 'core_reportbuilder', $field->get_formatted_name(false)),
|
||||
$this->entityname
|
||||
))
|
||||
->add_joins($this->get_joins())
|
||||
@@ -261,7 +261,7 @@ class custom_fields {
|
||||
$filter = (new filter(
|
||||
$typeclass,
|
||||
'customfield_' . $field->get('shortname'),
|
||||
new lang_string('customfieldcolumn', 'core_reportbuilder', $field->get_formatted_name()),
|
||||
new lang_string('customfieldcolumn', 'core_reportbuilder', $field->get_formatted_name(false)),
|
||||
$this->entityname,
|
||||
$datafieldsql
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user