You are here

public static function DynamicEntityReferenceOptionsTrait::isApplicable in Dynamic Entity Reference 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/DynamicEntityReferenceOptionsTrait.php \Drupal\dynamic_entity_reference\Plugin\Field\FieldWidget\DynamicEntityReferenceOptionsTrait::isApplicable()

This widget only support single target type dynamic entity reference fields. Select list Check boxes and radio buttons don't make sense for multiple target_types.

File

src/Plugin/Field/FieldWidget/DynamicEntityReferenceOptionsTrait.php, line 23

Class

DynamicEntityReferenceOptionsTrait
The common functionality between DynamicEntityReferenceOptionsWidgets.

Namespace

Drupal\dynamic_entity_reference\Plugin\Field\FieldWidget

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  return count(DynamicEntityReferenceItem::getTargetTypes($field_definition
    ->getSettings())) == 1;
}