From da4ded8a16d8a8fd9d6f580886bea525c33ec682 Mon Sep 17 00:00:00 2001 From: Gareth Barnard <1058419+gjb2048@users.noreply.github.com> Date: Fri, 1 Mar 2019 18:44:57 +0000 Subject: [PATCH] MDL-64818 blocks: blocks_for_region() is inefficient. --- lib/outputrenderers.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 8802a9e90ec..6dd4de47692 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1817,11 +1817,12 @@ class core_renderer extends renderer_base { */ public function blocks_for_region($region) { $blockcontents = $this->page->blocks->get_content_for_region($region, $this); - $blocks = $this->page->blocks->get_blocks_for_region($region); $lastblock = null; $zones = array(); - foreach ($blocks as $block) { - $zones[] = $block->title; + foreach ($blockcontents as $bc) { + if ($bc instanceof block_contents) { + $zones[] = $bc->title; + } } $output = '';