You are here

public static function GridStackMediaFormatter::isApplicable in GridStack 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/GridStackMediaFormatter.php \Drupal\gridstack\Plugin\Field\FieldFormatter\GridStackMediaFormatter::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 GridStackFormatterTrait::isApplicable

File

src/Plugin/Field/FieldFormatter/GridStackMediaFormatter.php, line 70

Class

GridStackMediaFormatter
Plugin implementation of the 'GridStack Media' formatter.

Namespace

Drupal\gridstack\Plugin\Field\FieldFormatter

Code

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