|
|
|
@ -93,11 +93,13 @@ class TwigExtension extends \Twig_Extension {
|
|
|
|
|
* @param string $theme |
|
|
|
|
* (Optional) The name of the theme to load the region. If it is not |
|
|
|
|
* provided then default theme will be used. |
|
|
|
|
* @param bool $include_template |
|
|
|
|
* (Optional) Render the output using the region's Twig template. |
|
|
|
|
* |
|
|
|
|
* @return array |
|
|
|
|
* A render array to display the region content. |
|
|
|
|
*/ |
|
|
|
|
public function drupalRegion($region, $theme = NULL) { |
|
|
|
|
public function drupalRegion($region, $theme = NULL, $include_template = FALSE) { |
|
|
|
|
$entity_type_manager = \Drupal::entityTypeManager(); |
|
|
|
|
$blocks = $entity_type_manager->getStorage('block')->loadByProperties([ |
|
|
|
|
'region' => $region, |
|
|
|
@ -122,6 +124,11 @@ class TwigExtension extends \Twig_Extension {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($include_template) { |
|
|
|
|
$build['#region'] = $region; |
|
|
|
|
$build['#theme_wrappers'] = ['region']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $build; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|