You are here

public static function MenuReferenceFormatter::isApplicable in Menu Reference Render (Formatter) 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/MenuReferenceFormatter.php \Drupal\menu_reference_render\Plugin\Field\FieldFormatter\MenuReferenceFormatter::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/MenuReferenceFormatter.php, line 54

Class

MenuReferenceFormatter
Plugin implementation of the 'menu_reference_render' formatter.

Namespace

Drupal\menu_reference_render\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {

  // Limit formatter to only menu entity types.
  return $field_definition
    ->getFieldStorageDefinition()
    ->getSetting('target_type') == 'menu';
}