diff -u b/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php --- b/core/modules/block/src/BlockListBuilder.php +++ b/core/modules/block/src/BlockListBuilder.php @@ -366,6 +366,7 @@ if (isset($operations['delete'])) { $operations['delete']['title'] = $this->t('Remove'); } + if ($entity instanceof OperationsProviderInterface) { $operations += $entity->getOperationLinks(); } diff -u b/core/modules/block_content/tests/src/Kernel/BlockContentTest.php b/core/modules/block_content/tests/src/Kernel/BlockContentTest.php --- b/core/modules/block_content/tests/src/Kernel/BlockContentTest.php +++ b/core/modules/block_content/tests/src/Kernel/BlockContentTest.php @@ -7,8 +7,6 @@ use Drupal\block_content\Entity\BlockContentType; use Drupal\Component\Plugin\PluginBase; use Drupal\KernelTests\KernelTestBase; -use Drupal\user\Entity\Role; -use Drupal\user\Entity\User; /** * Tests the block content. @@ -20,29 +18,16 @@ /** * {@inheritdoc} */ - public static $modules = ['block', 'block_content', 'system', 'user']; + protected static $modules = ['block', 'block_content', 'system', 'user']; /** * {@inheritdoc} */ - public function setUp() { + public function setUp(): void { parent::setUp(); - $this->installSchema('system', ['sequence']); + $this->installSchema('system', ['sequences']); $this->installEntitySchema('user'); $this->installEntitySchema('block_content'); - - $user = User::create([ - 'name' => 'tony', - 'mail' => 'tony@example.com', - ]); - $role = Role::create([ - 'label' => 'Views admin', - 'id' => 'views_admin', - ]); - $role->grantPermission('administer views'); - $role->save(); - $user->addRole($role->id()); - \Drupal::service('current_user')->setAccount($user); } /** diff -u b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php --- b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php +++ b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php @@ -2,6 +2,7 @@ namespace Drupal\views\Plugin\Block; +use Drupal\Core\Operations\OperationsProviderInterface; use Drupal\Core\Url; use Drupal\Core\Access\AccessResult; use Drupal\Core\Block\BlockBase; @@ -16,7 +17,7 @@ /** * Base class for Views block plugins. */ -abstract class ViewsBlockBase extends BlockBase implements ContainerFactoryPluginInterface { +abstract class ViewsBlockBase extends BlockBase implements ContainerFactoryPluginInterface, OperationsProviderInterface { /** * The View executable object. @@ -250,7 +251,7 @@ */ public function getOperationLinks() { $delta = $this->getDerivativeId(); - list($view, $display_id) = explode('-', $delta, 2); + [$view, $display_id] = explode('-', $delta, 2); $links = []; if ($this->moduleHandler->moduleExists('views_ui')) { $links['view-edit'] = [ diff -u b/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php b/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php --- b/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php @@ -4,8 +4,6 @@ use Drupal\block\Entity\Block; use Drupal\Core\Url; -use Drupal\user\Entity\Role; -use Drupal\user\Entity\User; use Drupal\views\Plugin\Block\ViewsBlock; use Drupal\views\Tests\ViewTestData; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; @@ -38,19 +36,6 @@ protected function setUp($import_test_views = TRUE): void { parent::setUp(); - $user = User::create([ - 'name' => 'test.user', - 'mail' => 'testing@example.com', - ]); - $role = Role::create([ - 'label' => 'Views admin', - 'id' => 'views_admin', - ]); - $role->grantPermission('administer views'); - $role->save(); - $user->addRole($role->id()); - \Drupal::service('current_user')->setAccount($user); - ViewTestData::createTestViews(static::class, ['block_test_views']); }