You are here

public static function ProductAttributesOverview::isApplicable in Commerce Core 8.2

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/product/src/Plugin/Field/FieldFormatter/ProductAttributesOverview.php, line 238

Class

ProductAttributesOverview
Plugin implementation of the 'commerce_product_attributes_overview' formatter.

Namespace

Drupal\commerce_product\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  $entity_type = $field_definition
    ->getTargetEntityTypeId();
  $field_name = $field_definition
    ->getName();
  return $entity_type == 'commerce_product' && $field_name == 'variations';
}