mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-74678 reportbuilder: Allow null in category description callback
Since category description is a nullable column, we need to allow null value in category description column callback in category entity
This commit is contained in:
parent
5e5e12e063
commit
0b82e9e9b3
@ -132,10 +132,14 @@ class cohort extends base {
|
||||
->add_joins($this->get_joins())
|
||||
->set_type(column::TYPE_TEXT)
|
||||
->add_fields("{$tablealias}.description, {$tablealias}.descriptionformat, {$tablealias}.id, {$tablealias}.contextid")
|
||||
->add_callback(static function(string $description, stdClass $cohort): string {
|
||||
->add_callback(static function(?string $description, stdClass $cohort): string {
|
||||
global $CFG;
|
||||
require_once("{$CFG->libdir}/filelib.php");
|
||||
|
||||
if ($description === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$description = file_rewrite_pluginfile_urls($description, 'pluginfile.php', $cohort->contextid, 'cohort',
|
||||
'description', $cohort->id);
|
||||
|
||||
|
@ -141,10 +141,14 @@ class course_category extends base {
|
||||
AND {$tablealiascontext}.contextlevel = " . CONTEXT_COURSECAT)
|
||||
->set_type(column::TYPE_TEXT)
|
||||
->add_fields("{$tablealias}.description, {$tablealias}.descriptionformat, {$tablealiascontext}.id AS contextid")
|
||||
->add_callback(static function(string $description, stdClass $category): string {
|
||||
->add_callback(static function(?string $description, stdClass $category): string {
|
||||
global $CFG;
|
||||
require_once("{$CFG->libdir}/filelib.php");
|
||||
|
||||
if ($description === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$description = file_rewrite_pluginfile_urls($description, 'pluginfile.php', $category->contextid, 'coursecat',
|
||||
'description', null);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user