You are here

public static function PadoAddToCartFormatter::isApplicable in Commerce Product Add-on 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 AddToCartFormatter::isApplicable

File

src/Plugin/Field/FieldFormatter/PadoAddToCartFormatter.php, line 103

Class

PadoAddToCartFormatter
Plugin implementation of the 'commerce_pado_add_to_cart' formatter.

Namespace

Drupal\commerce_pado\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  $return = parent::isApplicable($field_definition);
  $options = [];
  if ($return) {
    $options = self::getReferenceFieldOptions($field_definition);
  }
  return $return && !empty($options);
}