Version 1
[yaffs-website] / web / core / modules / views / src / Plugin / views / field / EntityLinkEdit.php
diff --git a/web/core/modules/views/src/Plugin/views/field/EntityLinkEdit.php b/web/core/modules/views/src/Plugin/views/field/EntityLinkEdit.php
new file mode 100644 (file)
index 0000000..2136525
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+namespace Drupal\views\Plugin\views\field;
+
+use Drupal\views\ResultRow;
+
+/**
+ * Field handler to present a link to edit an entity.
+ *
+ * @ingroup views_field_handlers
+ *
+ * @ViewsField("entity_link_edit")
+ */
+class EntityLinkEdit extends EntityLink {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getEntityLinkTemplate() {
+    return 'edit-form';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function renderLink(ResultRow $row) {
+    $this->options['alter']['query'] = $this->getDestinationArray();
+    return parent::renderLink($row);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getDefaultLabel() {
+    return $this->t('edit');
+  }
+
+}