Commit d77805a6 authored by borisson_'s avatar borisson_ Committed by borisson_
Browse files

Issue #2829636 by d.novikov, borisson_: Make ListItemProcessor::build() throw...

Issue #2829636 by d.novikov, borisson_: Make ListItemProcessor::build() throw an exception when no datasource is available
parent dfd17373
......@@ -6,6 +6,7 @@ use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\facets\Exception\InvalidProcessorException;
use Drupal\facets\FacetInterface;
use Drupal\facets\FacetSource\SearchApiFacetSourceInterface;
use Drupal\facets\Processor\BuildProcessorInterface;
......@@ -97,7 +98,10 @@ class ListItemProcessor extends ProcessorPluginBase implements BuildProcessorInt
$index = $facet->getFacetSource()->getIndex();
$field = $index->getField($field_identifier);
$entity = str_replace('entity:', '', $field->getDatasourceId());
if (!$field->getDatasourceId()) {
throw new InvalidProcessorException("This field has no datasource, there is no valid use for this processor with this facet");
$entity = $field->getDatasource()->getEntityTypeId();
// If it's an entity base field, we find it in the field definitions.
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