Skip to content

Commit

Permalink
theme/regions MDL-20204 Improved the finding of human names for regio…
Browse files Browse the repository at this point in the history
…ns, after looking in current theme it now looks in parent themes and base theme as well.
  • Loading branch information
moodler committed Jan 21, 2010
1 parent 1ad20d6 commit a546e52
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/outputlib.php
Expand Up @@ -1102,10 +1102,25 @@ public function setup_blocks($pagelayout, $blockmanager) {
*/
public function get_all_block_regions() {
$regions = array();
//TODO: this is weird because the regions from different layouts override each other
foreach ($this->layouts as $layoutinfo) {
foreach ($layoutinfo['regions'] as $region) {
$regions[$region] = get_string('region-' . $region, 'theme_' . $layoutinfo['theme']);
$regionstring = get_string('region-' . $region, 'theme_' . $layoutinfo['theme']);
if (substr($regionstring, 0, 1) != '[') { // A name exists in this theme, so use it
$regions[$region] = $regionstring;
} else { // Otherwise, try to find one elsewhere
// Check parents, if any
if (!empty($this->parents)) {
foreach ($this->parents as $parentthemename) {
$regionstring = get_string('region-' . $region, 'theme_'.$parentthemename);
if (substr($regionstring, 0, 1) != '[') { // A name exists in this theme, so use it
$regions[$region] = $regionstring;
}
}
}
if (empty($regions[$region])) { // Last resort, try the base theme for names
$regions[$region] = get_string('region-' . $region, 'theme_base');
}
}
}
}
return $regions;
Expand Down

0 comments on commit a546e52

Please sign in to comment.