public static function EntityReferenceRevisionsEntityFormatter::isApplicable in Entity Reference Revisions 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/ EntityReferenceRevisionsEntityFormatter.php, line 157
Class
- EntityReferenceRevisionsEntityFormatter
- Plugin implementation of the 'entity reference rendered entity' formatter.
Namespace
Drupal\entity_reference_revisions\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
// This formatter is only available for entity types that have a view
// builder.
$target_type = $field_definition
->getFieldStorageDefinition()
->getSetting('target_type');
return \Drupal::entityTypeManager()
->getDefinition($target_type)
->hasViewBuilderClass();
}