MDL-37516 Translate fieldnames on output only.

This reverts a change performed by the previous commit where user
fieldnames were being translated (and cached) when fetched,
causing the information to remain static later, not responding
to language switches (and perhaps leading to other problems if those
structures are used lated for DB / $USER comparisons.

With the commit, the translation happens on output, so no
potential interferences will happen and, also, the information
changes dynamically on lang switching.
This commit is contained in:
Eloy Lafuente (stronk7)
2013-07-02 20:39:05 +02:00
parent 6316bfa0c7
commit f8c54a7469
+4 -2
View File
@@ -547,7 +547,7 @@ abstract class condition_info_base {
}
} else {
$field = $condition->userfield;
$fieldname = get_user_field_name($condition->userfield);
$fieldname = $condition->userfield;
}
$details = new stdClass;
$details->fieldname = $fieldname;
@@ -828,7 +828,9 @@ abstract class condition_info_base {
// Need the array of operators
foreach ($this->item->conditionsfield as $field => $details) {
$a = new stdclass;
$a->field = format_string($details->fieldname, true, array('context' => $context));
// Display the fieldname into current lang.
$translatedfieldname = get_user_field_name($details->fieldname);
$a->field = format_string($translatedfieldname, true, array('context' => $context));
$a->value = s($details->value);
$information .= html_writer::start_tag('li');
$information .= get_string('requires_user_field_'.$details->operator, 'condition', $a) . ' ';