public static function FieldFormatterBase::isApplicable in (Entity Reference) Field Formatters 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/FieldFormatterBase.php \Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterBase::isApplicable()
- 3.x src/Plugin/Field/FieldFormatter/FieldFormatterBase.php \Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterBase::isApplicable()
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/ FieldFormatterBase.php, line 166
Class
- FieldFormatterBase
- Base class for field formatters.
Namespace
Drupal\field_formatter\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
$entity_type = \Drupal::entityTypeManager()
->getDefinition($field_definition
->getTargetEntityTypeId());
return $entity_type
->isSubclassOf(FieldableEntityInterface::class);
}