You are here

public static function LibraryItemFieldWidget::isApplicable in Library 8

Returns if the widget 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 widget can be used, FALSE otherwise.

Overrides WidgetBase::isApplicable

File

src/Plugin/Field/FieldWidget/LibraryItemFieldWidget.php, line 269

Class

LibraryItemFieldWidget
Plugin implementation of the 'library_item_field_widget' widget.

Namespace

Drupal\library\Plugin\Field\FieldWidget

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  $target_entity_type_id = $field_definition
    ->getFieldStorageDefinition()
    ->getSetting('target_type');
  if ($target_entity_type_id === 'library_item') {
    return TRUE;
  }
  return FALSE;
}