Completed
Pull Request — 8.x-1.x (#123)
by
unknown
03:45
created

EntityLabel::settingsForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
/**
4
 * Contains \Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay\EntityLabel.
5
 */
6
7
namespace Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay;
8
9
use Drupal\Core\Entity\EntityInterface;
10
use Drupal\entity_browser\FieldWidgetDisplayBase;
11
12
/**
13
 * Displays a label of the entity.
14
 *
15
 * @EntityBrowserFieldWidgetDisplay(
16
 *   id = "label",
17
 *   label = @Translation("Entity label"),
18
 *   description = @Translation("Displays entity with a label.")
19
 * )
20
 */
21
class EntityLabel extends FieldWidgetDisplayBase {
22
23
  /**
24
   * {@inheritdoc}
25
   */
26
  public function view(EntityInterface $entity) {
27
    return $entity->label();
28
  }
29
30
}
31