You are here

public static function SlickParagraphsFormatter::isApplicable in Slick Paragraphs 8

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

File

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

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';
}