public function GlossaryAZWidget::supportsFacet in Search API AZ Glossary 8.4
Same name and namespace in other branches
- 8.3 src/Plugin/facets/widget/GlossaryAZWidget.php \Drupal\search_api_glossary\Plugin\facets\widget\GlossaryAZWidget::supportsFacet()
Checks if the facet is supported by this processor.
Reasons why this would be unsupported can be chosen by the processor.
Parameters
\Drupal\facets\FacetInterface $facet: The facet to check for.
Return value
bool Returns true when allowed, false otherwise.
Overrides WidgetPluginBase::supportsFacet
See also
\Drupal\facets\Processor\ProcessorInterface::supportsFacet
File
- src/
Plugin/ facets/ widget/ GlossaryAZWidget.php, line 160
Class
- GlossaryAZWidget
- The GlossaryAZ widget.
Namespace
Drupal\search_api_glossary\Plugin\facets\widgetCode
public function supportsFacet(FacetInterface $facet) {
// Are we dealing with Glossary field?
// See https://www.drupal.org/node/2877691.
// Load up the search index and processor.
$glossary_processor = $facet
->getFacetSource()
->getIndex()
->getProcessor('glossary');
// Name of the field to check against.
$glossary_field_id = $facet
->getFieldIdentifier();
// Check if chosen field is glossary or not.
// checkFieldName will return TRUE or FALSE
// see Glossary::checkFieldName()
$is_glossary_field = $glossary_processor
->checkFieldName($glossary_field_id);
return $is_glossary_field;
}