public static function InlineParagraphsWidget::isApplicable

File

paragraphs/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php, line 1521

Class

InlineParagraphsWidget
Plugin implementation of the 'entity_reference paragraphs' widget.

Namespace

Drupal\paragraphs\Plugin\Field\FieldWidget

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  $target_type = $field_definition
    ->getSetting('target_type');
  $paragraph_type = \Drupal::entityTypeManager()
    ->getDefinition($target_type);
  if ($paragraph_type) {
    return $paragraph_type
      ->entityClassImplements(ParagraphInterface::class);
  }
  return FALSE;
}