public static function PriceCalculatedFormatter::isApplicable in Commerce Core 8.2
Same name in this branch
- 8.2 modules/price/src/Plugin/Field/FieldFormatter/PriceCalculatedFormatter.php \Drupal\commerce_price\Plugin\Field\FieldFormatter\PriceCalculatedFormatter::isApplicable()
- 8.2 modules/order/src/Plugin/Field/FieldFormatter/PriceCalculatedFormatter.php \Drupal\commerce_order\Plugin\Field\FieldFormatter\PriceCalculatedFormatter::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
- modules/
order/ src/ Plugin/ Field/ FieldFormatter/ PriceCalculatedFormatter.php, line 198
Class
- PriceCalculatedFormatter
- Alternative implementation of the 'commerce_price_calculated' formatter.
Namespace
Drupal\commerce_order\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
$entity_type = \Drupal::entityTypeManager()
->getDefinition($field_definition
->getTargetEntityTypeId());
return $entity_type
->entityClassImplements(PurchasableEntityInterface::class);
}