You are here

public static function PrivateMessageThreadMessageFormatter::isApplicable in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/PrivateMessageThreadMessageFormatter.php \Drupal\private_message\Plugin\Field\FieldFormatter\PrivateMessageThreadMessageFormatter::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

src/Plugin/Field/FieldFormatter/PrivateMessageThreadMessageFormatter.php, line 122

Class

PrivateMessageThreadMessageFormatter
Defines the private message thread message field formatter.

Namespace

Drupal\private_message\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
  return $field_definition
    ->getFieldStorageDefinition()
    ->getTargetEntityTypeId() == 'private_message_thread' && $field_definition
    ->getFieldStorageDefinition()
    ->getSetting('target_type') == 'private_message';
}