diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index bb86637..1d22278 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -287,24 +287,4 @@ public function isDefaultRevision($new_value = NULL) { return $return; } - /** - * Implements Drupal\Core\Entity\EntityInterface::getOperations(). - */ - public function getOperations() { - $uri = $this->uri(); - $operations['edit'] = array( - 'title' => t('Edit'), - 'href' => $uri['path'] . '/edit', - 'options' => $uri['options'], - 'weight' => 10, - ); - $operations['delete'] = array( - 'title' => t('Delete'), - 'href' => $uri['path'] . '/delete', - 'options' => $uri['options'], - 'weight' => 100, - ); - return $operations; - } - } diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index d50df45..d8b6eae 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -219,13 +219,4 @@ public function getRevisionId(); * $new_value was passed, the previous value is returned. */ public function isDefaultRevision($new_value = NULL); - - /** - * Provides an array of information to render operation links. - * - * @return array - * An array of operation link data. - */ - public function getOperations(); - } diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php index 9f1df2a..8c8d165 100644 --- a/core/lib/Drupal/Core/Entity/EntityListController.php +++ b/core/lib/Drupal/Core/Entity/EntityListController.php @@ -53,6 +53,26 @@ public function load() { return $this->storage->load(); } + /** + * Implements Drupal\Core\Entity\EntityListControllerInterface::getOperations(). + */ + public function getOperations(EntityInterface $entity) { + $uri = $entity->uri(); + $operations['edit'] = array( + 'title' => t('Edit'), + 'href' => $uri['path'] . '/edit', + 'options' => $uri['options'], + 'weight' => 10, + ); + $operations['delete'] = array( + 'title' => t('Delete'), + 'href' => $uri['path'] . '/delete', + 'options' => $uri['options'], + 'weight' => 100, + ); + return $operations; + } + public function getPath() { return $this->entityInfo['list path']; } @@ -83,7 +103,7 @@ public function buildRow(EntityInterface $entity) { */ public function buildOperations(EntityInterface $entity) { // Retrieve and sort operations. - $operations = $entity->getOperations(); + $operations = $this->getOperations($entity); uasort($operations, 'drupal_sort_weight'); $build = array( '#theme' => 'links', @@ -104,9 +124,6 @@ public function render() { '@label' => $this->entityInfo['label'], '@add-url' => $this->getPath() . '/add', )), - '#attributes' => array( - 'id' => 'config-entity-listing', - ), ); foreach ($this->load() as $entity) { $build['#rows'][$entity->id()] = $this->buildRow($entity); diff --git a/core/lib/Drupal/Core/Entity/EntityListControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityListControllerInterface.php index ac45ffb..e564243 100644 --- a/core/lib/Drupal/Core/Entity/EntityListControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityListControllerInterface.php @@ -28,6 +28,17 @@ public function getStorageController(); public function load(); /** + * Provides an array of information to render operation links. + * + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity the operations are for. + * + * @return array + * An array of operation link data to use in buildOperations. + */ + public function getOperations(EntityInterface $entity); + + /** * Builds the header row. * * @return array