You are here

public static function PhotosAlbumFormatter::isApplicable in Album Photos 8.5

Same name and namespace in other branches
  1. 6.0.x src/Plugin/Field/FieldFormatter/PhotosAlbumFormatter.php \Drupal\photos\Plugin\Field\FieldFormatter\PhotosAlbumFormatter::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

File

src/Plugin/Field/FieldFormatter/PhotosAlbumFormatter.php, line 196

Class

PhotosAlbumFormatter
Plugin implementation of the 'media_thumbnail' formatter.

Namespace

Drupal\photos\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {

  // This formatter is only available for entity types that reference
  // media items.
  // @todo check if node type photos?
  return $field_definition
    ->getFieldStorageDefinition()
    ->getSetting('target_type') == 'node';
}