You are here

public static function UserNameFormatter::isApplicable in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/src/Plugin/Field/FieldFormatter/UserNameFormatter.php \Drupal\user\Plugin\Field\FieldFormatter\UserNameFormatter::isApplicable()
  2. 10 core/modules/user/src/Plugin/Field/FieldFormatter/UserNameFormatter.php \Drupal\user\Plugin\Field\FieldFormatter\UserNameFormatter::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/user/src/Plugin/Field/FieldFormatter/UserNameFormatter.php, line 85

Class

UserNameFormatter
Plugin implementation of the 'user_name' formatter.

Namespace

Drupal\user\Plugin\Field\FieldFormatter

Code

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