]> git.mjollnir.org Git - moodle.git/commit
blocklib: cache (and used cached) block instances properly in $pageblocks
authormartinlanghoff <martinlanghoff>
Wed, 17 May 2006 04:39:43 +0000 (04:39 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 17 May 2006 04:39:43 +0000 (04:39 +0000)
commit66c7e47b273a9ef69dec04471411e647f30a59c3
tree1d161d44693c08a5fb0d120b279f99de4576d55e
parent0adf53f6cdb529737170841705b554ede70f9c5e
blocklib: cache (and used cached) block instances properly in $pageblocks

Now blocks_have_content() caches instantiated block objects inside $pageblocks
and blocks_print_blocks() uses them if available. This behaviour now matches
the documentation: blocks instances are created only once, get_content()
may be invoked several times.

A better fix would be to cache the _output_ of the block (the ->content
property) but it may bite us if any block is counting on being called twice.

Discussion at: http://moodle.org/mod/forum/discuss.php?d=45867
lib/blocklib.php