You are here

public function GlossaryAZPadItemsProcessor::supportsFacet in Search API AZ Glossary 8.4

Same name and namespace in other branches
  1. 8.3 src/Plugin/facets/processor/GlossaryAZPadItemsProcessor.php \Drupal\search_api_glossary\Plugin\facets\processor\GlossaryAZPadItemsProcessor::supportsFacet()

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/GlossaryAZPadItemsProcessor.php, line 94

Class

GlossaryAZPadItemsProcessor
Provides a processor to rewrite facet results to pad out missing alpha.

Namespace

Drupal\search_api_glossary\Plugin\facets\processor

Code

public function supportsFacet(FacetInterface $facet) {

  // Check if
  // 1) The correct widget is chosen for the facet
  // 2) If the glossary processor is enabled in Search API index.
  $widget = $facet
    ->getWidget()['type'];
  $search_processors = $facet
    ->getFacetSource()
    ->getIndex()
    ->getProcessors();
  if ($widget == 'glossaryaz' && array_key_exists('glossary', $search_processors)) {

    // Glossary processor is enabled.
    return TRUE;
  }
  return FALSE;
}