mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-65327 performance: Lazy-load module name strings
This commit is contained in:
parent
6735197cc2
commit
d91aa1e760
4 changed files with 10 additions and 11 deletions
|
@ -261,8 +261,8 @@ class core_course_external extends external_api {
|
|||
$module['id'] = $cm->id;
|
||||
$module['name'] = external_format_string($cm->name, $modcontext->id);
|
||||
$module['instance'] = $cm->instance;
|
||||
$module['modname'] = $cm->modname;
|
||||
$module['modplural'] = $cm->modplural;
|
||||
$module['modname'] = (string) $cm->modname;
|
||||
$module['modplural'] = (string) $cm->modplural;
|
||||
$module['modicon'] = $cm->get_icon_url()->out(false);
|
||||
$module['indent'] = $cm->indent;
|
||||
$module['onclick'] = $cm->onclick;
|
||||
|
|
|
@ -559,12 +559,10 @@ function get_module_types_names($plural = false) {
|
|||
if ($allmods = $DB->get_records("modules")) {
|
||||
foreach ($allmods as $mod) {
|
||||
if (file_exists("$CFG->dirroot/mod/$mod->name/lib.php") && $mod->visible) {
|
||||
$modnames[0][$mod->name] = get_string("modulename", "$mod->name");
|
||||
$modnames[1][$mod->name] = get_string("modulenameplural", "$mod->name");
|
||||
$modnames[0][$mod->name] = get_string("modulename", "$mod->name", null, true);
|
||||
$modnames[1][$mod->name] = get_string("modulenameplural", "$mod->name", null, true);
|
||||
}
|
||||
}
|
||||
core_collator::asort($modnames[0]);
|
||||
core_collator::asort($modnames[1]);
|
||||
}
|
||||
}
|
||||
return $modnames[(int)$plural];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue