Commit 8e347224 authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2868380 by borisson_, mkalkbrenner: Be more defensive when trying to...

Issue #2868380 by borisson_, mkalkbrenner: Be more defensive when trying to create display derivatives
parent 706ce181
......@@ -4,6 +4,7 @@ namespace Drupal\facets\Plugin\facets\facet_source;
use Drupal\Component\Plugin\PluginBase;
use Drupal\facets\FacetSource\FacetSourceDeriverBase;
use Drupal\search_api\IndexInterface;
/**
* Derives a facet source plugin definition for every Search API display plugin.
......@@ -28,10 +29,19 @@ class SearchApiDisplayDeriver extends FacetSourceDeriverBase {
continue;
}
/** @var \Drupal\search_api\Display\DisplayInterface $display */
$display = $display_plugin_manager->createInstance($display_id);
$server = $display->getIndex()
->getServerInstance();
$index = $display->getIndex();
// If we can't reliably load the index, we should just cancel trying to
// create a derivative for this display.
if (!$index instanceof IndexInterface) {
continue;
}
// Get the server linked to the index.
$server = $index->getServerInstance();
// If facets are not supported by the server, don't actually add this to
// the list of plugins.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment