You are here

public static function ParagraphsJQueryUIAccordionFormatter::isApplicable in Paragraphs jQuery UI Accordion 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/ParagraphsJQueryUIAccordionFormatter.php, line 342
Contains \Drupal\paragraphs_jquery_ui_accordion\Plugin\Field\FieldFormatter\ParagraphsJQueryUIAccordionFormatter.

Class

ParagraphsJQueryUIAccordionFormatter
Plugin implementation of the 'paragraphs_jquery_ui_accordion_formatter' formatter.

Namespace

Drupal\paragraphs_jquery_ui_accordion\Plugin\Field\FieldFormatter

Code

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