MDL-77666 contentbank: format category names for display.

This commit is contained in:
Paul Holden
2023-03-16 23:27:13 +00:00
parent 033858e249
commit 71e751565c
+5 -10
View File
@@ -14,26 +14,20 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* core_contentbank specific renderers
*
* @package core_contentbank
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_contentbank\output;
use context_coursecat;
use core_contentbank\content;
use core_contentbank\contentbank;
use renderable;
use templatable;
use renderer_base;
use stdClass;
use core_contentbank\content;
/**
* Class containing data for bank content
*
* @package core_contentbank
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -138,7 +132,8 @@ class bankcontent implements renderable, templatable {
}
$options = [];
foreach ($this->allowedcategories as $allowedcategory) {
$options[$allowedcategory->ctxid] = $allowedcategory->name;
$options[$allowedcategory->ctxid] = format_string($allowedcategory->name, true,
context_coursecat::instance($allowedcategory->ctxinstance));
}
if (!empty($options)) {
$allowedcontexts['categories'] = [get_string('coursecategories') => $options];