You are here

public static function SlickParagraphsFormatter::isApplicable in Slick Paragraphs 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/SlickParagraphsFormatter.php \Drupal\slick_paragraphs\Plugin\Field\FieldFormatter\SlickParagraphsFormatter::isApplicable()

Overrides SlickMediaFormatter::isApplicable

File

src/Plugin/Field/FieldFormatter/SlickParagraphsFormatter.php, line 45

Class

SlickParagraphsFormatter
Plugin implementation of the 'Slick Paragraphs Media' formatter.

Namespace

Drupal\slick_paragraphs\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  $storage = $field_definition
    ->getFieldStorageDefinition();

  // Excludes host, prevents complication with multiple nested paragraphs.
  $paragraph = $storage
    ->getTargetEntityTypeId() === 'paragraph';
  return $paragraph && $storage
    ->isMultiple() && $storage
    ->getSetting('target_type') === 'paragraph';
}