From e2049d770c2f0c4dcb2193472c8dc63328eb60bc Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 16 Oct 2023 17:22:59 +0100 Subject: [PATCH] MDL-79705 reportbuilder: remove checkbox field callback handling. We no longer need special handling of this field type, because it now returns language strings rather than HTML markup for a checkbox element on display. --- reportbuilder/classes/local/helpers/user_profile_fields.php | 5 ++--- .../tests/local/helpers/user_profile_fields_test.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/reportbuilder/classes/local/helpers/user_profile_fields.php b/reportbuilder/classes/local/helpers/user_profile_fields.php index 6e5d419fd1d..36cb0276b5c 100644 --- a/reportbuilder/classes/local/helpers/user_profile_fields.php +++ b/reportbuilder/classes/local/helpers/user_profile_fields.php @@ -180,9 +180,8 @@ class user_profile_fields { ->set_type($columntype) ->set_is_sortable($columntype !== column::TYPE_LONGTEXT) ->add_callback(static function($value, stdClass $row, profile_field_base $field): string { - // Special handling of checkboxes, we want to display their boolean state rather than the input element itself. - if (is_a($field, 'profile_field_checkbox')) { - return format::boolean_as_text($value); + if ($value === null) { + return ''; } $field->data = $value; diff --git a/reportbuilder/tests/local/helpers/user_profile_fields_test.php b/reportbuilder/tests/local/helpers/user_profile_fields_test.php index 44599cd499c..c8c35f9e571 100644 --- a/reportbuilder/tests/local/helpers/user_profile_fields_test.php +++ b/reportbuilder/tests/local/helpers/user_profile_fields_test.php @@ -240,7 +240,7 @@ class user_profile_fields_test extends core_reportbuilder_testcase { [ 'c0_firstname' => 'Admin', 'c1_data' => '', - 'c2_data' => 'Not set', + 'c2_data' => '', 'c3_data' => '', 'c4_data' => '', 'c5_data' => '',