You are here

public static function PriceCalculatedFormatter::isApplicable in Price 2.0.x

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

1 call to PriceCalculatedFormatter::isApplicable()
price_form_views_ui_config_item_form_alter in ./price.module
Implements hook_form_FORM_ID_alter().

File

src/Plugin/Field/FieldFormatter/PriceCalculatedFormatter.php, line 129

Class

PriceCalculatedFormatter
Plugin implementation of the 'price_calculated' formatter.

Namespace

Drupal\price\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  $entity_type = \Drupal::entityTypeManager()
    ->getDefinition($field_definition
    ->getTargetEntityTypeId());
  return $entity_type
    ->entityClassImplements(ContentEntityInterface::class);
}