MDL-74175 cohort: correct type/callback of entity category column.

This commit is contained in:
Paul Holden 2022-03-11 11:12:40 +00:00
parent 967d9b2546
commit b73a69b920
2 changed files with 6 additions and 4 deletions

View File

@ -94,11 +94,11 @@ class cohort extends base {
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->set_type(column::TYPE_TEXT)
->add_fields("{$tablealias}.contextid")
->set_is_sortable(true)
->add_callback(static function(int $contextid): string {
return context::instance_by_id($contextid)->get_context_name(false);
->add_callback(static function($contextid): string {
return context::instance_by_id((int) $contextid)->get_context_name(false);
});
// Name column.

View File

@ -478,7 +478,9 @@ final class column {
* The callback should implement the following signature (where $value is the first column field, $row is all column
* fields, and $additionalarguments are those passed on from this method):
*
* The type of the $value parameter passed to the callback is determined by calling {@see set_type}
* The type of the $value parameter passed to the callback is determined by calling {@see set_type}, however note that
* if the column is part of a report source and can be aggregated using one of the "Group concatenation" methods then the
* type should be omitted if it's not string
*
* function($value, stdClass $row[, $additionalarguments]): string
*