|
|
@ -116,6 +116,14 @@ class TwigExtension extends \Twig_Extension { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Title block needs special treatment. |
|
|
|
|
|
|
|
if ($block_plugin instanceof TitleBlockPluginInterface) { |
|
|
|
|
|
|
|
$request = \Drupal::request(); |
|
|
|
|
|
|
|
$route_match = \Drupal::routeMatch(); |
|
|
|
|
|
|
|
$title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject()); |
|
|
|
|
|
|
|
$block_plugin->setTitle($title); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$content = $block_plugin->build(); |
|
|
|
$content = $block_plugin->build(); |
|
|
|
|
|
|
|
|
|
|
|
if ($content && !Element::isEmpty($content)) { |
|
|
|
if ($content && !Element::isEmpty($content)) { |
|
|
@ -148,6 +156,10 @@ class TwigExtension extends \Twig_Extension { |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($block_plugin instanceof TitleBlockPluginInterface) { |
|
|
|
|
|
|
|
$build['#cache']['contexts'][] = 'url'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($content)) { |
|
|
|
if (!empty($content)) { |
|
|
|
CacheableMetadata::createFromRenderArray($build) |
|
|
|
CacheableMetadata::createFromRenderArray($build) |
|
|
|
->merge(CacheableMetadata::createFromRenderArray($content)) |
|
|
|
->merge(CacheableMetadata::createFromRenderArray($content)) |
|
|
|