summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgit2018-10-31 09:22:04 (GMT)
committerJoris Vercammen2018-10-31 09:22:04 (GMT)
commit68335a8287e1e8a838293f1f43f0f717a0a01c5d (patch)
tree4ab31b44f6d3f1acd79aff3d062af338929a7925
parentf9c5e312407bf74303190b9e4885a7113971407e (diff)
Issue #3010274 by n_e_: Fatal error when using facet summary block on Search API page
-rw-r--r--modules/facets_summary/src/Plugin/Block/FacetsSummaryBlock.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/facets_summary/src/Plugin/Block/FacetsSummaryBlock.php b/modules/facets_summary/src/Plugin/Block/FacetsSummaryBlock.php
index 54c476b..5b9255a 100644
--- a/modules/facets_summary/src/Plugin/Block/FacetsSummaryBlock.php
+++ b/modules/facets_summary/src/Plugin/Block/FacetsSummaryBlock.php
@@ -98,16 +98,16 @@ class FacetsSummaryBlock extends BlockBase implements FacetsSummaryBlockInterfac
}
/** @var \Drupal\views\ViewExecutable $view */
- $view = $facets_summary->getFacetSource()->getViewsDisplay();
-
- $build['#attached']['drupalSettings']['facets_views_ajax'] = [
- 'facets_summary_ajax' => [
- 'facets_summary_id' => $facets_summary->id(),
- 'view_id' => $view->id(),
- 'current_display_id' => $view->current_display,
- 'ajax_path' => Url::fromRoute('views.ajax')->toString(),
- ],
- ];
+ if ($view = $facets_summary->getFacetSource()->getViewsDisplay()) {
+ $build['#attached']['drupalSettings']['facets_views_ajax'] = [
+ 'facets_summary_ajax' => [
+ 'facets_summary_id' => $facets_summary->id(),
+ 'view_id' => $view->id(),
+ 'current_display_id' => $view->current_display,
+ 'ajax_path' => Url::fromRoute('views.ajax')->toString(),
+ ],
+ ];
+ }
return $build;