public function GlossaryAZAllItemsProcessor::supportsFacet in Search API AZ Glossary 8.3
Same name and namespace in other branches
- 8.4 src/Plugin/facets/processor/GlossaryAZAllItemsProcessor.php \Drupal\search_api_glossary\Plugin\facets\processor\GlossaryAZAllItemsProcessor::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/ GlossaryAZAllItemsProcessor.php, line 83
Class
- GlossaryAZAllItemsProcessor
- Provides a processor to show All items in Glossary AZ.
Namespace
Drupal\search_api_glossary\Plugin\facets\processorCode
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;
}