function FormatterBase::isApplicable

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Field/FormatterBase.php \Drupal\Core\Field\FormatterBase::isApplicable()
  2. 10 core/lib/Drupal/Core/Field/FormatterBase.php \Drupal\Core\Field\FormatterBase::isApplicable()
  3. 8.9.x core/lib/Drupal/Core/Field/FormatterBase.php \Drupal\Core\Field\FormatterBase::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 FormatterInterface::isApplicable

4 calls to FormatterBase::isApplicable()
CommentPermalinkFormatter::isApplicable in core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php
FileMediaFormatterBase::isApplicable in core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php
FileSize::isApplicable in core/modules/file/src/Plugin/Field/FieldFormatter/FileSize.php
OEmbedFormatter::isApplicable in core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php
14 methods override FormatterBase::isApplicable()
AggregatorTitleFormatter::isApplicable in core/modules/aggregator/src/Plugin/Field/FieldFormatter/AggregatorTitleFormatter.php
AuthorFormatter::isApplicable in core/modules/user/src/Plugin/Field/FieldFormatter/AuthorFormatter.php
AuthorNameFormatter::isApplicable in core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php
BaseFieldFileFormatterBase::isApplicable in core/modules/file/src/Plugin/Field/FieldFormatter/BaseFieldFileFormatterBase.php
CommentPermalinkFormatter::isApplicable in core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php

... See full list

File

core/lib/Drupal/Core/Field/FormatterBase.php, line 166

Class

FormatterBase
Base class for 'Field formatter' plugin implementations.

Namespace

Drupal\Core\Field

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  // By default, formatters are available for all fields.
  return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.