You are here

public static function MediaLibraryWidget::isApplicable in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php \Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::isApplicable()
  2. 10 core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php \Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::isApplicable()

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

core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php, line 114

Class

MediaLibraryWidget
Plugin implementation of the 'media_library_widget' widget.

Namespace

Drupal\media_library\Plugin\Field\FieldWidget

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  return $field_definition
    ->getSetting('target_type') === 'media';
}