You are here

public static function EntityReferenceShsFormatter::isApplicable in Simple hierarchical select 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Field/FieldFormatter/EntityReferenceShsFormatter.php \Drupal\shs\Plugin\Field\FieldFormatter\EntityReferenceShsFormatter::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/EntityReferenceShsFormatter.php, line 134

Class

EntityReferenceShsFormatter
Plugin implementation of the 'entity reference taxonomy term SHS' formatter.

Namespace

Drupal\shs\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {

  // This formatter is available for taxonomy terms only.
  return $field_definition
    ->getFieldStorageDefinition()
    ->getSetting('target_type') == 'taxonomy_term';
}