You are here

public static function ConfigPagesReferenceFieldFormatter::isApplicable in Config Pages 8.2

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 EntityReferenceEntityFormatter::isApplicable

File

src/Plugin/Field/FieldFormatter/ConfigPagesReferenceFieldFormatter.php, line 59

Class

ConfigPagesReferenceFieldFormatter
Plugin implementation of the 'config page entity reference' formatter.

Namespace

Drupal\config_pages\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {

  // This formatter is only available for 'config_pages_type' target type.
  $target_type = $field_definition
    ->getFieldStorageDefinition()
    ->getSetting('target_type');
  return $target_type === 'config_pages_type';
}