You are here

public static function ContentModerationStateFormatter::isApplicable in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/Plugin/Field/FieldFormatter/ContentModerationStateFormatter.php \Drupal\content_moderation\Plugin\Field\FieldFormatter\ContentModerationStateFormatter::isApplicable()
  2. 9 core/modules/content_moderation/src/Plugin/Field/FieldFormatter/ContentModerationStateFormatter.php \Drupal\content_moderation\Plugin\Field\FieldFormatter\ContentModerationStateFormatter::isApplicable()

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

Overrides FormatterBase::isApplicable

File

core/modules/content_moderation/src/Plugin/Field/FieldFormatter/ContentModerationStateFormatter.php, line 72

Class

ContentModerationStateFormatter
Plugin implementation of the 'content_moderation_state' formatter.

Namespace

Drupal\content_moderation\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  return $field_definition
    ->getName() === 'moderation_state' && $field_definition
    ->getTargetEntityTypeId() !== 'content_moderation_state';
}