diff -u b/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php --- b/core/lib/Drupal/Core/Entity/EntityListController.php +++ b/core/lib/Drupal/Core/Entity/EntityListController.php @@ -114,6 +114,7 @@ public function getOperations(EntityInterface $entity) { $operations = array_merge($this->moduleHandler->invokeAll('entity_operation', array($entity)), $this->getDefaultOperations($entity)); $this->moduleHandler->alter('entity_operation', $operations, $entity); + uasort($operations, '\Drupal\Component\Utility\SortArray::sortByWeightElement'); return $operations; } @@ -193,11 +194,9 @@ * @see \Drupal\Core\Entity\EntityListController::render() */ public function buildOperations(EntityInterface $entity) { - $operations = $this->getOperations($entity); - uasort($operations, '\Drupal\Component\Utility\SortArray::sortByWeightElement'); $build = array( '#type' => 'operations', - '#links' => $operations, + '#links' => $this->getOperations($entity), ); return $build; } diff -u b/core/modules/system/entity.api.php b/core/modules/system/entity.api.php --- b/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -700,11 +700,10 @@ * \Drupal\Core\Entity\EntityListControllerInterface::getOperations(). */ function hook_entity_operation(\Drupal\Core\Entity\EntityInterface $entity) { - $uri = $entity->uri(); $operations = array(); $operations['translate'] = array( 'title' => t('Translate'), - 'href' => $uri['path'] . '/translate', + 'route_name' => 'foo_module.entity.translate', 'weight' => 50, ); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityListController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityListController.php @@ -30,8 +30,8 @@ public function load() { /** * {@inheritdoc} */ - public function getOperations(EntityInterface $entity) { - $operations = parent::getOperations($entity); + public function getDefaultOperations(EntityInterface $entity) { + $operations = parent::getDefaultOperations($entity); $uri = $entity->uri(); // Ensure the edit operation exists since it is access controlled. only in patch2: unchanged: --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockListController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockListController.php @@ -34,8 +34,8 @@ public function buildRow(EntityInterface $entity) { /** * {@inheritdoc} */ - public function getOperations(EntityInterface $entity) { - $operations = parent::getOperations($entity); + public function getDefaultOperations(EntityInterface $entity) { + $operations = parent::getDefaultOperations($entity); // The custom block edit path does not contain '/edit'. if (isset($operations['edit'])) { $uri = $entity->uri(); only in patch2: unchanged: --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationEntityListController.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationEntityListController.php @@ -83,13 +83,13 @@ public function buildHeader() { /** * {@inheritdoc} */ - public function buildOperations(EntityInterface $entity) { - $operations = parent::buildOperations($entity); - foreach (array_keys($operations['#links']) as $operation) { + public function getOperations(EntityInterface $entity) { + $operations = parent::getOperations($entity); + foreach (array_keys($operations) as $operation) { // This is a translation UI for translators. Show the translation // operation only. if (!($operation == 'translate')) { - unset($operations['#links'][$operation]); + unset($operations[$operation]); } } return $operations; only in patch2: unchanged: --- a/core/modules/user/lib/Drupal/user/Controller/UserListController.php +++ b/core/modules/user/lib/Drupal/user/Controller/UserListController.php @@ -142,8 +142,8 @@ public function buildRow(EntityInterface $entity) { /** * {@inheritdoc} */ - public function getOperations(EntityInterface $entity) { - $operations = parent::getOperations($entity); + public function getDefaultOperations(EntityInterface $entity) { + $operations = parent::getDefaultOperations($entity); if (isset($operations['edit'])) { $destination = drupal_get_destination(); $operations['edit']['query'] = $destination;