Skip to content
Snippets Groups Projects

Issue #3052574: Facets with AJAX not working in most of situations

1 file
+ 11
0
Compare changes
  • Side-by-side
  • Inline
@@ -6,6 +6,7 @@ use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\InvokeCommand;
use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Block\BlockManager;
use Drupal\Core\Block\Plugin\Block\Broken;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Path\CurrentPathStack;
use Drupal\Core\PathProcessor\PathProcessorManager;
@@ -184,6 +185,16 @@ class FacetBlockAjaxController extends ControllerBase {
}
}
}
elseif ($block_instance instanceof Broken) {
$block_entity = $this->storage->load($block_id);
if ($block_entity) {
$block_view = $this->entityTypeManager
->getViewBuilder('block')
->view($block_entity);
$block_view = (string) $this->renderer->renderPlain($block_view);
$response->addCommand(new ReplaceCommand($block_selector, $block_view));
}
}
}
}
Loading