You are here

public function FieldCollectionItem::label in Field collection 8

Same name and namespace in other branches
  1. 8.3 src/Entity/FieldCollectionItem.php \Drupal\field_collection\Entity\FieldCollectionItem::label()

Overrides \Drupal\Core\Entity\label().

Overrides ContentEntityBase::label

File

src/Entity/FieldCollectionItem.php, line 75

Class

FieldCollectionItem
Defines the field collection item entity class.

Namespace

Drupal\field_collection\Entity

Code

public function label() {
  $field_label = $this
    ->getHost()
    ->getFieldDefinition($this
    ->bundle())
    ->label();
  if (empty($field_label)) {
    return parent::label();
  }
  else {
    return t('@label @delta of @host', [
      '@label' => $field_label,
      '@delta' => $this
        ->getDelta(),
      '@host' => $this
        ->getHost()
        ->label(),
    ]);
  }
}