commit 54108d14cefebda41eda1d490fffddd137797e23
Author: Bart Feenstra <bart@mynameisbart.com>
Date:   Thu Jan 2 19:48:53 2014 +0100

    foo

diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/EntityOperations.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/EntityOperations.php
new file mode 100644
index 0000000..23d4eae
--- /dev/null
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/EntityOperations.php
@@ -0,0 +1,120 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\views\Plugin\views\field\EntityOperations.
+ */
+
+namespace Drupal\views\Plugin\views\field;
+
+use Drupal\Core\Entity\EntityListControllerInterface;
+use Drupal\Core\Entity\EntityStorageControllerInterface;
+use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
+use Drupal\views\ResultRow;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Renders all operations links for an entity.
+ *
+ * Every definition of this handler in a hook_views_data() implementation must
+ * contain the following two keys:
+ * - entity_type: the entity type's machine name.
+ * - id_field: the name of the field that contains the entity IDs.
+ *
+ * @ingroup views_field_handlers
+ *
+ * @PluginID("views_entity_operations")
+ */
+class EntityOperations extends FieldPluginBase implements ContainerFactoryPluginInterface {
+
+  /**
+   * The entity list.
+   *
+   * @var \Drupal\Core\Entity\EntityListControllerInterface
+   */
+  protected $entityList;
+
+  /**
+   * The entity storage.
+   *
+   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
+   */
+  protected $entityStorage;
+
+  /**
+   * Constructor.
+   *
+   * @param array $configuration
+   * @param string $plugin_id
+   * @param array $plugin_definition
+   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $entity_storage
+   *    The storage controller of the entity type.
+   * @param \Drupal\Core\Entity\EntityListControllerInterface $entity_list
+   *    The list controller of the entity type.
+   */
+  public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityStorageControllerInterface $entity_storage, EntityListControllerInterface $entity_list) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
+    $this->entityList = $entity_list;
+    $this->entityStorage = $entity_storage;
+    $this->realField = $plugin_definition['id_field'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
+    /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
+    $entity_manager = $container->get('entity.manager');
+    return new static($configuration, $plugin_id, $plugin_definition, $entity_manager->getStorageController($plugin_definition['entity_type']), $entity_manager->getListController($plugin_definition['entity_type']));
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function usesGroupBy() {
+    return FALSE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function defineOptions() {
+    $options = parent::defineOptions();
+
+    $options['destination'] = array(
+      'default' => TRUE,
+      'bool' => TRUE,
+    );
+
+    return $options;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildOptionsForm(&$form, &$form_state) {
+    parent::buildOptionsForm($form, $form_state);
+    $form['destination'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Include destination'),
+      '#description' => $this->t('Include a <code>destination</code> parameter in the link to return the user to the original view upon completing the link action.'),
+      '#default_value' => $this->options['destination'],
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function render(ResultRow $values) {
+    $id = $this->getValue($values);
+    $entity = $this->entityStorage->load($id);
+
+    $build = array(
+      '#type' => 'operations',
+      '#links' => $this->entityList->getOperations($entity),
+    );
+
+    return $build;
+  }
+
+}
