Browse Source

Issue #3260248 by Barry_Fisher: BlockViewBuilder error prevents cron from running when called from CLI

merge-requests/17/head
Barry Fisher 2 years ago committed by Chi
parent
commit
b36c208cc2
  1. 11
      src/View/BlockViewBuilder.php

11
src/View/BlockViewBuilder.php

@ -121,9 +121,14 @@ class BlockViewBuilder {
if ($access->isAllowed()) { if ($access->isAllowed()) {
// Title block needs a special treatment. // Title block needs a special treatment.
if ($block_plugin instanceof TitleBlockPluginInterface) { if ($block_plugin instanceof TitleBlockPluginInterface) {
$request = $this->requestStack->getCurrentRequest(); // Account for the scenario that a NullRouteMatch is returned. This, for
$title = $this->titleResolver->getTitle($request, $this->routeMatch->getRouteObject()); // example, is the case when Search API is indexing the site during
$block_plugin->setTitle($title); // Drush cron.
if ($route = $this->routeMatch->getRouteObject()) {
$request = $this->requestStack->getCurrentRequest();
$title = $this->titleResolver->getTitle($request, $route);
$block_plugin->setTitle($title);
}
} }
// Place the content returned by the block plugin into a 'content' child // Place the content returned by the block plugin into a 'content' child

Loading…
Cancel
Save