From 0885166fcc8457ed6049b204671dedf9ca6cbcef Mon Sep 17 00:00:00 2001 From: Jonathan Champ Date: Wed, 2 May 2012 10:23:07 -0400 Subject: [PATCH] MDL-32689 Allow Blocks to decide whether they are collapsible. --- blocks/moodleblock.class.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index 644c225efe2..3d67dd707ab 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -250,8 +250,9 @@ class block_base { } } - if (empty($CFG->allowuserblockhiding) || - (empty($bc->content) && empty($bc->footer))) { + if (empty($CFG->allowuserblockhiding) + || (empty($bc->content) && empty($bc->footer)) + || !$this->instance_can_be_collapsed()) { $bc->collapsible = block_contents::NOT_HIDEABLE; } else if (get_user_preferences('block' . $bc->blockinstanceid . 'hidden', false)) { $bc->collapsible = block_contents::HIDDEN; @@ -630,7 +631,7 @@ class block_base { } /** - * If overridden and set to true by the block it will not be hidable when + * If overridden and set to false by the block it will not be hidable when * editing is turned on. * * @return bool @@ -639,6 +640,15 @@ class block_base { return true; } + /** + * If overridden and set to false by the block it will not be collapsible. + * + * @return bool + */ + public function instance_can_be_collapsed() { + return true; + } + /** @callback callback functions for comments api */ public static function comment_template($options) { $ret = <<