MDL-70486 output: Improve check for block region name string existence
* The fact that non-existing strings are returned in certain format starting with the bracket, is kind of side debugging effect. The value is really undefined and should not be relied upon. * The string could actually exist and be worded so that its first character is also the square bracket.
This commit is contained in:
+10
-10
@@ -2451,22 +2451,22 @@ class theme_config {
|
||||
* @return string
|
||||
*/
|
||||
protected function get_region_name($region, $theme) {
|
||||
$regionstring = get_string('region-' . $region, 'theme_' . $theme);
|
||||
// A name exists in this theme, so use it
|
||||
if (substr($regionstring, 0, 1) != '[') {
|
||||
return $regionstring;
|
||||
|
||||
$stringman = get_string_manager();
|
||||
|
||||
// Check if the name is defined in the theme.
|
||||
if ($stringman->string_exists('region-' . $region, 'theme_' . $theme)) {
|
||||
return get_string('region-' . $region, 'theme_' . $theme);
|
||||
}
|
||||
|
||||
// Otherwise, try to find one elsewhere
|
||||
// Check parents, if any
|
||||
// Check the theme parents.
|
||||
foreach ($this->parents as $parentthemename) {
|
||||
$regionstring = get_string('region-' . $region, 'theme_' . $parentthemename);
|
||||
if (substr($regionstring, 0, 1) != '[') {
|
||||
return $regionstring;
|
||||
if ($stringman->string_exists('region-' . $region, 'theme_' . $parentthemename)) {
|
||||
return get_string('region-' . $region, 'theme_' . $parentthemename);
|
||||
}
|
||||
}
|
||||
|
||||
// Last resort, try the boost theme for names
|
||||
// Last resort, try the boost theme for names.
|
||||
return get_string('region-' . $region, 'theme_boost');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user