You are here

public static function SocialPrivateMessageMemberFormatter::isApplicable in Open Social 8

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

modules/social_features/social_private_message/src/Plugin/Field/Fieldformatter/SocialPrivateMessageMemberFormatter.php, line 94

Class

SocialPrivateMessageMemberFormatter
Class SocialPrivateMessageMemberFormatter.

Namespace

Drupal\social_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') == 'user';
}