MDL-57678 core_course: Remove padding of nbsp's on category names

Padding nested course categories by space to make them render in a tree
structure does not really make a lot of sense as they are already being
rendered as full paths. It's simpler to show them without the
indentation.
This commit is contained in:
Jun Pataleta
2020-07-15 18:27:02 +08:00
parent 89ce4db476
commit e1a310bde7
+3 -9
View File
@@ -637,20 +637,14 @@ function get_category_or_system_context($categoryid) {
}
/**
* Returns full course categories trees to be used in html_writer::select()
* Returns the list of full course categories to be used in html_writer::select()
*
* Calls {@link core_course_category::make_categories_list()} to build the tree and
* adds whitespace to denote nesting
* Calls {@see core_course_category::make_categories_list()} to build the list.
*
* @return array array mapping course category id to the display name
*/
function make_categories_options() {
$cats = core_course_category::make_categories_list('', 0, ' / ');
foreach ($cats as $key => $value) {
// Prefix the value with the number of spaces equal to category depth (number of separators in the value).
$cats[$key] = str_repeat(' ', substr_count($value, ' / ')). $value;
}
return $cats;
return core_course_category::make_categories_list('', 0, ' / ');
}
/**