You are here

public static function AutoImageStyleMediaDefault::isApplicable in Auto image style 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 FormatterBase::isApplicable

File

src/Plugin/Field/FieldFormatter/AutoImageStyleMediaDefault.php, line 232

Class

AutoImageStyleMediaDefault
Plugin for responsive media image formatter.

Namespace

Drupal\auto_image_style\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  return $field_definition
    ->getFieldStorageDefinition()
    ->getSetting('target_type') == 'media';
}