mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
MDL-82571 customfield_number: small coding style cleanup.
This commit is contained in:
parent
cbcb9d071f
commit
865e8f3e90
2 changed files with 7 additions and 7 deletions
|
@ -143,7 +143,7 @@ class field_controller extends \core_customfield\field_controller {
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function prepare_field_for_display(mixed $value, ?context $context = null): ?string {
|
public function prepare_field_for_display(mixed $value, ?context $context = null): ?string {
|
||||||
if ((float)$value == 0) {
|
if ((float) $value == 0) {
|
||||||
$value = $this->get_configdata_property('displaywhenzero');
|
$value = $this->get_configdata_property('displaywhenzero');
|
||||||
if ((string) $value === '') {
|
if ((string) $value === '') {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -132,17 +132,17 @@ final class data_controller_test extends advanced_testcase {
|
||||||
'Export float value' => [42, 42.0, [
|
'Export float value' => [42, 42.0, [
|
||||||
'decimalplaces' => 2,
|
'decimalplaces' => 2,
|
||||||
'display' => '{value}',
|
'display' => '{value}',
|
||||||
'displaywhenzero' => 0],
|
'displaywhenzero' => 0,
|
||||||
],
|
]],
|
||||||
'Export value with a prefix' => [10, '$ 10.00', [
|
'Export value with a prefix' => [10, '$ 10.00', [
|
||||||
'decimalplaces' => 2,
|
'decimalplaces' => 2,
|
||||||
'display' => $template,
|
'display' => $template,
|
||||||
'displaywhenzero' => 0],
|
'displaywhenzero' => 0,
|
||||||
],
|
]],
|
||||||
'Export value when zero' => [0, 'Unknown', [
|
'Export value when zero' => [0, 'Unknown', [
|
||||||
'display' => '{value}',
|
'display' => '{value}',
|
||||||
'displaywhenzero' => $whenzero],
|
'displaywhenzero' => $whenzero,
|
||||||
],
|
]],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue