public function GlossaryAZWidgetOrderProcessor::supportsFacet in Search API AZ Glossary 8.4
Same name and namespace in other branches
- 8.3 src/Plugin/facets/processor/GlossaryAZWidgetOrderProcessor.php \Drupal\search_api_glossary\Plugin\facets\processor\GlossaryAZWidgetOrderProcessor::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/ GlossaryAZWidgetOrderProcessor.php, line 220
Class
- GlossaryAZWidgetOrderProcessor
- A processor that orders the results by display value.
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;
}