public static function HierarchicalFormatter::isApplicable in Hierarchical Term Formatter 8
Returns if the formatter can be used for the provided field.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition that should be checked.
Return value
bool TRUE if the formatter can be used, FALSE otherwise.
Overrides FormatterBase::isApplicable
File
- src/
Plugin/ Field/ FieldFormatter/ HierarchicalFormatter.php, line 131
Class
- HierarchicalFormatter
- Plugin implementation of the 'rating' formatter.
Namespace
Drupal\hierarchical_term_formatter\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
// This formatter is only available for taxonomy terms.
return $field_definition
->getFieldStorageDefinition()
->getSetting('target_type') == 'taxonomy_term';
}