public function BooleanItemProcessor::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/ BooleanItemProcessor.php, line 98
Class
- BooleanItemProcessor
- Provides a processor for boolean labels.
Namespace
Drupal\facets\Plugin\facets\processorCode
public function supportsFacet(FacetInterface $facet) {
$field_identifier = $facet
->getFieldIdentifier();
$facet_source = $facet
->getFacetSource();
$field = $facet_source
->getIndex()
->getField($field_identifier);
if ($field
->getType() == "boolean") {
return TRUE;
}
$data_definition = $facet
->getDataDefinition();
if ($data_definition
->getDataType() == "boolean") {
return TRUE;
}
if (!$data_definition instanceof ComplexDataDefinitionInterface) {
return FALSE;
}
$property_definitions = $data_definition
->getPropertyDefinitions();
foreach ($property_definitions as $definition) {
if ($definition
->getDataType() == "boolean") {
return TRUE;
}
}
return FALSE;
}