You are here

public function TranslateEntityAggregatedFieldProcessor::supportsFacet in Facets 8

Checks if the facet is supported by this widget.

Reasons why this would be unsupported can be chosen by the widget.

Parameters

\Drupal\facets\FacetInterface $facet: The facet to check for.

Return value

bool Returns true when allowed, false otherwise.

Overrides ProcessorPluginBase::supportsFacet

See also

\Drupal\facets\Widget\WidgetPluginInterface::supportsFacet

File

src/Plugin/facets/processor/TranslateEntityAggregatedFieldProcessor.php, line 219

Class

TranslateEntityAggregatedFieldProcessor
Transforms the results to show the translated entity label.

Namespace

Drupal\facets\Plugin\facets\processor

Code

public function supportsFacet(FacetInterface $facet) {
  $facet_source = $facet
    ->getFacetSource();
  if ($facet_source instanceof SearchApiFacetSourceInterface) {

    /** @var \Drupal\search_api\Item\Field $field */
    $field_identifier = $facet
      ->getFieldIdentifier();
    $field = $facet_source
      ->getIndex()
      ->getField($field_identifier);
    if ($field
      ->getPropertyPath() === 'aggregated_field') {
      return TRUE;
    }
  }
  return FALSE;
}