blocks MDL-23976 Added block method to determine if any of the blocks in a block region are docked. Kudo's to Brandon for the patch.

This commit is contained in:
Sam Hemelryk
2010-09-08 09:01:15 +00:00
parent 1ce282c884
commit 4d6fd15c00
+24
View File
@@ -419,6 +419,7 @@ class block_manager {
/**
* Checks to see whether all of the blocks within the given region are docked
*
* @see region_uses_dock
* @param string $region
* @return bool True if all of the blocks within that region are docked
*/
@@ -436,6 +437,29 @@ class block_manager {
return true;
}
/**
* Checks to see whether any of the blocks within the given regions are docked
*
* @see region_completely_docked
* @param array|string $regions array of regions (or single region)
* @return bool True if any of the blocks within that region are docked
*/
public function region_uses_dock($regions, $output) {
if (!$this->page->theme->enable_dock) {
return false;
}
$this->check_is_loaded();
foreach((array)$regions as $region) {
$this->ensure_content_created($region, $output);
foreach($this->visibleblockcontent[$region] as $instance) {
if(!empty($instance->content) && get_user_preferences('docked_block_instance_'.$instance->blockinstanceid, 0)) {
return true;
}
}
}
return false;
}
/// Actions ====================================================================
/**