You are here

public function ExampleMultilingualField::getLabel in Extra Field 8.2

Same name and namespace in other branches
  1. 8 modules/extra_field_example/src/Plugin/ExtraField/Display/ExampleMultilingualField.php \Drupal\extra_field_example\Plugin\ExtraField\Display\ExampleMultilingualField::getLabel()

The label of the field.

If applicable, the code has to take care of the translatability.

Return value

string|\Drupal\Core\StringTranslation\TranslatableMarkup The field label.

Overrides ExtraFieldDisplayFormattedBase::getLabel

File

modules/extra_field_example/src/Plugin/ExtraField/Display/ExampleMultilingualField.php, line 56

Class

ExampleMultilingualField
Example Extra field Display.

Namespace

Drupal\extra_field_example\Plugin\ExtraField\Display

Code

public function getLabel() {
  $label = '';
  if ($tagsField = $this
    ->getTagsField()) {

    // Use the Tags field's label.
    $label = $tagsField
      ->getFieldDefinition()
      ->getLabel();
  }
  return $label;
}