You are here

public static function ModerationStateWidget::isApplicable in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget::isApplicable()
  2. 9 core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget::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

1 call to ModerationStateWidget::isApplicable()
ModerationStateWidgetTest::testIsApplicable in core/modules/content_moderation/tests/src/Kernel/ModerationStateWidgetTest.php
@covers ::isApplicable

File

core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php, line 193

Class

ModerationStateWidget
Plugin implementation of the 'moderation_state_default' widget.

Namespace

Drupal\content_moderation\Plugin\Field\FieldWidget

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  return is_a($field_definition
    ->getClass(), ModerationStateFieldItemList::class, TRUE);
}