Version 1
[yaffs-website] / web / modules / contrib / entity_browser / src / Plugin / EntityBrowser / FieldWidgetDisplay / EntityLabel.php
diff --git a/web/modules/contrib/entity_browser/src/Plugin/EntityBrowser/FieldWidgetDisplay/EntityLabel.php b/web/modules/contrib/entity_browser/src/Plugin/EntityBrowser/FieldWidgetDisplay/EntityLabel.php
new file mode 100644 (file)
index 0000000..632170b
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay;
+
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\entity_browser\FieldWidgetDisplayBase;
+
+/**
+ * Displays a label of the entity.
+ *
+ * @EntityBrowserFieldWidgetDisplay(
+ *   id = "label",
+ *   label = @Translation("Entity label"),
+ *   description = @Translation("Displays entity with a label.")
+ * )
+ */
+class EntityLabel extends FieldWidgetDisplayBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function view(EntityInterface $entity) {
+    return $entity->label();
+  }
+
+}