reverted: --- b/core/modules/block/block.module +++ a/core/modules/block/block.module @@ -6,13 +6,11 @@ */ use Drupal\Component\Utility\Html; -use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Installer\InstallerKernel; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Link; use Drupal\Core\Url; use Drupal\language\ConfigurableLanguageInterface; -use Drupal\system\BlockOperationsProviderInterface; use Drupal\system\Entity\Menu; use Drupal\block\Entity\Block; @@ -317,24 +315,3 @@ } } } - -/** - * Implements hook_entity_operation(). - */ -function block_entity_operation(EntityInterface $entity) { - $operations = []; - if ($entity instanceof BlockOperationsProviderInterface) { - $operations += $entity->getOperationLinks(); - } - - foreach ($operations as $operation) { - if ($operation['url']->getOption('query')) { - $operation['url']->mergeOptions('query', ['destination' => 'admin/structure/block']); - } - else { - $operation['url']->setOption('query', ['destination' => 'admin/structure/block']); - } - } - - return $operations; -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityListBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -5,6 +5,7 @@ use Drupal\Core\Messenger\MessengerTrait; use Drupal\Core\Routing\RedirectDestinationTrait; use Drupal\Core\Url; +use Drupal\system\BlockOperationsProviderInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -193,6 +194,22 @@ public function buildOperations(EntityInterface $entity) { '#links' => $this->getOperations($entity), ]; + if ($entity instanceof BlockOperationsProviderInterface) { + $build['#links'] += $entity->getOperationLinks(); + } + + if (is_array($build['#links'])) { + foreach ($build['#links'] as $key => $operation) { + if ($operation['url']->getOption('query')) { + $operation['url']->mergeOptions(['query', ['destination' => 'admin/structure/block']]); + } + else { + $operation['url']->setOption('query', ['destination' => 'admin/structure/block']); + } + $build['#links'][$key] = $operation; + } + } + return $build; }