You are here

public static function LibraryItemSummaryFormatter::isApplicable in Paragraphs 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 ParagraphsSummaryFormatter::isApplicable

File

modules/paragraphs_library/src/Plugin/Field/FieldFormatter/LibraryItemSummaryFormatter.php, line 41

Class

LibraryItemSummaryFormatter
Plugin implementation of the 'paragraph_summary' formatter.

Namespace

Drupal\paragraphs_library\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  if ($field_definition
    ->getTargetEntityTypeId() == 'paragraphs_library_item' && $field_definition
    ->getName() == 'paragraphs') {
    return TRUE;
  }
  return FALSE;
}