diff --git a/core/modules/block_content/block_content.routing.yml b/core/modules/block_content/block_content.routing.yml index 1d41aa3098f..82b31488873 100644 --- a/core/modules/block_content/block_content.routing.yml +++ b/core/modules/block_content/block_content.routing.yml @@ -8,32 +8,6 @@ block_content.add_page: requirements: _entity_create_any_access: 'block_content' -# @todo Deprecate this route once -# https://www.drupal.org/project/drupal/issues/3159210 is fixed, or remove -# it in Drupal 11. -# @see https://www.drupal.org/node/3320855 -entity.block_content_type.collection.bc: - path: '/admin/structure/block/block-content/types' - defaults: - _controller: '\Drupal\block_content\Controller\BlockContentController::blockContentTypeRedirect' - options: - _admin_route: TRUE - requirements: - _permission: 'administer block types' - -# @todo Deprecate this route once -# https://www.drupal.org/project/drupal/issues/3159210 is fixed, or remove -# it in Drupal 11. -# @see https://www.drupal.org/node/3320855 -entity.block_content_type.edit_form.bc: - path: '/admin/structure/block/block-content/manage/{block_content_type}' - defaults: - _controller: '\Drupal\block_content\Controller\BlockContentController::blockContentTypeRedirect' - options: - _admin_route: TRUE - requirements: - _permission: 'administer block types' - block_content.add_form: path: '/block/add/{block_content_type}' defaults: @@ -65,20 +39,6 @@ entity.block_content.edit_form: _entity_access: 'block_content.update' block_content: \d+ -# @todo Deprecate this route once -# https://www.drupal.org/project/drupal/issues/3159210 is fixed, or remove -# it in Drupal 11. -# @see https://www.drupal.org/node/2317981 -entity.block_content.edit_form.bc: - path: '/block/{block_content}' - defaults: - _controller: '\Drupal\block_content\Controller\BlockContentController::editRedirect' - options: - _admin_route: TRUE - requirements: - _entity_access: 'block_content.update' - block_content: \d+ - entity.block_content.delete_form: path: '/admin/content/block/{block_content}/delete' defaults: @@ -90,20 +50,6 @@ entity.block_content.delete_form: _entity_access: 'block_content.delete' block_content: \d+ -# @todo Deprecate this route once -# https://www.drupal.org/project/drupal/issues/3159210 is fixed, or remove -# it in Drupal 11. -# @see https://www.drupal.org/node/2317981 -entity.block_content.delete_form.bc: - path: '/block/{block_content}/delete' - defaults: - _controller: '\Drupal\block_content\Controller\BlockContentController::editRedirect' - options: - _admin_route: TRUE - requirements: - _entity_access: 'block_content.delete' - block_content: \d+ - block_content.type_add: path: '/admin/structure/block-content/add' defaults: @@ -119,14 +65,3 @@ entity.block_content.collection: _entity_list: 'block_content' requirements: _permission: 'access block library+administer block content' - -# @todo Deprecate this route once -# https://www.drupal.org/project/drupal/issues/3159210 is fixed, or remove -# it in Drupal 11. -# @see https://www.drupal.org/node/3320855 -entity.block_content.collection.bc: - path: '/admin/structure/block/block-content' - defaults: - _controller: '\Drupal\block_content\Controller\BlockContentController::blockLibraryRedirect' - requirements: - _permission: 'access block library+administer block content' diff --git a/core/modules/block_content/src/Controller/BlockContentController.php b/core/modules/block_content/src/Controller/BlockContentController.php index dbe844d9d6b..8177e44e873 100644 --- a/core/modules/block_content/src/Controller/BlockContentController.php +++ b/core/modules/block_content/src/Controller/BlockContentController.php @@ -4,15 +4,11 @@ namespace Drupal\block_content\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Routing\PathChangedHelper; -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\block_content\BlockContentInterface; use Drupal\block_content\BlockContentTypeInterface; use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RedirectResponse; class BlockContentController extends ControllerBase { @@ -140,100 +136,4 @@ class BlockContentController extends ControllerBase { return $this->t('Add %type content block', ['%type' => $block_content_type->label()]); } - /** - * Provides a redirect to the list of block types. - * - * @param \Drupal\Core\Routing\RouteMatchInterface $route_match - * A route match object, used for the route name and the parameters. - * @param \Symfony\Component\HttpFoundation\Request $request - * The current request object. - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - * - * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use - * /admin/structure/block-content directly instead of - * /admin/structure/block/block-content/types. - * - * @see https://www.drupal.org/node/3320855 - */ - public function blockContentTypeRedirect(RouteMatchInterface $route_match, Request $request): RedirectResponse { - @trigger_error('The path /admin/structure/block/block-content/types is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use /admin/structure/block-content. See https://www.drupal.org/node/3320855', E_USER_DEPRECATED); - $helper = new PathChangedHelper($route_match, $request); - $params = [ - '%old_path' => $helper->oldPath(), - '%new_path' => $helper->newPath(), - '%change_record' => 'https://www.drupal.org/node/3320855', - ]; - $warning_message = $this->t('You have been redirected from %old_path. Update links, shortcuts, and bookmarks to use %new_path.', $params); - $this->messenger()->addWarning($warning_message); - $this->getLogger('block_content')->warning('A user was redirected from %old_path. This redirect will be removed in a future version of Drupal. Update links, shortcuts, and bookmarks to use %new_path. See %change_record for more information.', $params); - - return $helper->redirect(); - } - - /** - * Provides a redirect to the content block library. - * - * @param \Drupal\Core\Routing\RouteMatchInterface $route_match - * A route match object, used for the route name and the parameters. - * @param \Symfony\Component\HttpFoundation\Request $request - * The current request object. - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - * - * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use - * /admin/content/block directly instead of - * /admin/structure/block/block-content. - * - * @see https://www.drupal.org/node/3320855 - */ - public function blockLibraryRedirect(RouteMatchInterface $route_match, Request $request) { - @trigger_error('The path /admin/structure/block/block-content is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use /admin/content/block. See https://www.drupal.org/node/3320855', E_USER_DEPRECATED); - $helper = new PathChangedHelper($route_match, $request); - $params = [ - '%old_path' => $helper->oldPath(), - '%new_path' => $helper->newPath(), - '%change_record' => 'https://www.drupal.org/node/3320855', - ]; - $warning_message = $this->t('You have been redirected from %old_path. Update links, shortcuts, and bookmarks to use %new_path.', $params); - $this->messenger()->addWarning($warning_message); - $this->getLogger('block_content') - ->warning('A user was redirected from %old_path. This redirect will be removed in a future version of Drupal. Update links, shortcuts, and bookmarks to use %new_path. See %change_record for more information.', $params); - - return $helper->redirect(); - } - - /** - * Provides a redirect to block edit page. - * - * @param \Drupal\Core\Routing\RouteMatchInterface $route_match - * A route match object, used for the route name and the parameters. - * @param \Symfony\Component\HttpFoundation\Request $request - * The current request object. - * @param Drupal\block_content\BlockContentInterface $block_content - * The block to be edited. - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - * - * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use - * /admin/content/block/{block_content} directly instead of - * /block/{block_content}. - * - * @see https://www.drupal.org/node/3320855 - */ - public function editRedirect(RouteMatchInterface $route_match, Request $request, BlockContentInterface $block_content): RedirectResponse { - @trigger_error('The path /block/{block_content} is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use /admin/content/block/{block_content}. See https://www.drupal.org/node/3320855', E_USER_DEPRECATED); - $helper = new PathChangedHelper($route_match, $request); - $params = [ - '%old_path' => $helper->oldPath(), - '%new_path' => $helper->newPath(), - '%change_record' => 'https://www.drupal.org/node/3320855', - ]; - $warning_message = $this->t('You have been redirected from %old_path. Update links, shortcuts, and bookmarks to use %new_path.', $params); - $this->messenger()->addWarning($warning_message); - $this->getLogger('block_content')->warning('A user was redirected from %old_path to %new_path. This redirect will be removed in a future version of Drupal. Update links, shortcuts, and bookmarks to use %new_path. See %change_record for more information.', $params); - - return $helper->redirect(); - } - } diff --git a/core/modules/block_content/tests/src/Functional/BlockContentRedirectTest.php b/core/modules/block_content/tests/src/Functional/BlockContentRedirectTest.php deleted file mode 100644 index e271f842955..00000000000 --- a/core/modules/block_content/tests/src/Functional/BlockContentRedirectTest.php +++ /dev/null @@ -1,74 +0,0 @@ -drupalLogin($this->adminUser); - $this->expectDeprecation('The path /admin/structure/block/block-content/types is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use /admin/structure/block-content. See https://www.drupal.org/node/3320855'); - $this->drupalGet('/admin/structure/block/block-content/types'); - $this->assertSession() - ->pageTextContains("You have been redirected from admin/structure/block/block-content/types. Update links, shortcuts, and bookmarks to use admin/structure/block-content."); - } - - /** - * Tests the deprecation message from the old block library page. - * - * @group legacy - */ - public function testBlockLibraryRedirect() { - $this->drupalLogin($this->adminUser); - $this->expectDeprecation('The path /admin/structure/block/block-content is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use /admin/content/block. See https://www.drupal.org/node/3320855'); - $this->drupalGet('admin/structure/block/block-content'); - $this->assertSession() - ->pageTextContains("You have been redirected from admin/structure/block/block-content. Update links, shortcuts, and bookmarks to use admin/content/block."); - } - - /** - * Tests the deprecation message from the old block edit page. - * - * @group legacy - */ - public function testBlockContentEditRedirect(): void { - $block = $this->createBlockContent(); - $this->drupalLogin($this->adminUser); - $this->expectDeprecation('The path /block/{block_content} is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use /admin/content/block/{block_content}. See https://www.drupal.org/node/3320855'); - $this->drupalGet("/block/{$block->id()}"); - $this->assertSession() - ->pageTextContains("You have been redirected from block/{$block->id()}. Update links, shortcuts, and bookmarks to use admin/content/block/{$block->id()}."); - } - - /** - * Tests the deprecation message from the old block delete page. - * - * @group legacy - */ - public function testBlockContentDeleteRedirect(): void { - $block = $this->createBlockContent(); - $this->drupalLogin($this->adminUser); - $this->expectDeprecation('The path /block/{block_content} is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use /admin/content/block/{block_content}. See https://www.drupal.org/node/3320855'); - $this->drupalGet("/block/{$block->id()}/delete"); - $this->assertSession() - ->pageTextContains("You have been redirected from block/{$block->id()}/delete. Update links, shortcuts, and bookmarks to use admin/content/block/{$block->id()}/delete."); - } - -} diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php index b76512c8497..60310e0a959 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php @@ -508,7 +508,7 @@ class InlineBlockTest extends InlineBlockTestBase { $this->assertSaveLayout(); $node_1_block_id = $this->getLatestBlockEntityId(); - $this->drupalGet("block/$node_1_block_id"); + $this->drupalGet("admin/content/block/$node_1_block_id"); $assert_session->pageTextNotContains('You are not authorized to access this page'); $this->drupalLogout(); @@ -516,13 +516,13 @@ class InlineBlockTest extends InlineBlockTestBase { 'administer nodes', ])); - $this->drupalGet("block/$node_1_block_id"); + $this->drupalGet("admin/content/block/$node_1_block_id"); $assert_session->pageTextContains('You are not authorized to access this page'); $this->drupalLogin($this->drupalCreateUser([ 'create and edit custom blocks', ])); - $this->drupalGet("block/$node_1_block_id"); + $this->drupalGet("admin/content/block/$node_1_block_id"); $assert_session->pageTextNotContains('You are not authorized to access this page'); }