You are here

public static function ShowEmailAddress::isApplicable in Show Email Address 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

src/Plugin/Field/FieldFormatter/ShowEmailAddress.php, line 130

Class

ShowEmailAddress
Plugin implementation of the 'show_email_address' formatter.

Namespace

Drupal\show_email\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {

  // Check if this entity is user otherwise hide it.
  if ($field_definition
    ->getTargetEntityTypeId() != 'user') {
    return FALSE;
  }

  // By default, formatters are available for all fields.
  return TRUE;
}