From b8f87efef7ae0465436cad984087aeea747614e9 Mon Sep 17 00:00:00 2001 From: Chi Date: Sat, 13 May 2017 12:06:14 +0300 Subject: [PATCH] Issue #2877132 by ay13: Print a block that is disabled --- src/TwigExtension.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/TwigExtension.php b/src/TwigExtension.php index 16ea12f..37e76eb 100644 --- a/src/TwigExtension.php +++ b/src/TwigExtension.php @@ -67,14 +67,16 @@ class TwigExtension extends \Twig_Extension { * * @param mixed $id * The ID of the block to render. + * @param bool $check_access + * (Optional) Indicates that access check is required. * * @return null|array * A render array for the block or NULL if the block does not exist. */ - public function drupalBlock($id) { + public function drupalBlock($id, $check_access = TRUE) { $entity_type_manager = \Drupal::entityTypeManager(); $block = $entity_type_manager->getStorage('block')->load($id); - if ($block && $this->entityAccess($block)) { + if ($block && (!$check_access || $this->entityAccess($block))) { return $entity_type_manager->getViewBuilder('block')->view($block); } }