You are here

public static function PriceCalculatedFormatter::isApplicable in Commerce Core 8.2

Same name in this branch
  1. 8.2 modules/price/src/Plugin/Field/FieldFormatter/PriceCalculatedFormatter.php \Drupal\commerce_price\Plugin\Field\FieldFormatter\PriceCalculatedFormatter::isApplicable()
  2. 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

1 call to PriceCalculatedFormatter::isApplicable()
commerce_price_form_views_ui_config_item_form_alter in modules/price/commerce_price.module
Implements hook_form_FORM_ID_alter().

File

modules/price/src/Plugin/Field/FieldFormatter/PriceCalculatedFormatter.php, line 141

Class

PriceCalculatedFormatter
Plugin implementation of the 'commerce_price_calculated' formatter.

Namespace

Drupal\commerce_price\Plugin\Field\FieldFormatter

Code

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