Issue #3333569 by alorenc, lauriii, smustgrave, larowlan: Breadcrumb for local tasks of Custom Blocks should contain the name of the custom block not the entity ID

merge-requests/3289/head
Lauri Eskola 2023-01-25 12:39:26 +02:00
parent 89eb557574
commit bfe3f5dc98
No known key found for this signature in database
GPG Key ID: 382FC0F5B0DF53F8
3 changed files with 19 additions and 0 deletions

View File

@ -22,6 +22,7 @@ entity.block_content.canonical:
path: '/block/{block_content}' path: '/block/{block_content}'
defaults: defaults:
_entity_form: 'block_content.edit' _entity_form: 'block_content.edit'
_title_callback: '\Drupal\Core\Entity\Controller\EntityController::title'
options: options:
_admin_route: TRUE _admin_route: TRUE
requirements: requirements:

View File

@ -3,6 +3,7 @@
namespace Drupal\Tests\block_content\Functional; namespace Drupal\Tests\block_content\Functional;
use Drupal\block_content\Entity\BlockContent; use Drupal\block_content\Entity\BlockContent;
use Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait;
/** /**
* Create a block and test block edit functionality. * Create a block and test block edit functionality.
@ -11,6 +12,8 @@ use Drupal\block_content\Entity\BlockContent;
*/ */
class PageEditTest extends BlockContentTestBase { class PageEditTest extends BlockContentTestBase {
use AssertBreadcrumbTrait;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -23,6 +26,7 @@ class PageEditTest extends BlockContentTestBase {
parent::setUp(); parent::setUp();
$this->drupalPlaceBlock('page_title_block'); $this->drupalPlaceBlock('page_title_block');
$this->drupalPlaceBlock('system_breadcrumb_block');
} }
/** /**
@ -77,6 +81,15 @@ class PageEditTest extends BlockContentTestBase {
$this->drupalGet("block/" . $revised_block->id()); $this->drupalGet("block/" . $revised_block->id());
$this->clickLink('Delete'); $this->clickLink('Delete');
$this->assertSession()->pageTextContains('Are you sure you want to delete the custom block ' . $revised_block->label() . '?'); $this->assertSession()->pageTextContains('Are you sure you want to delete the custom block ' . $revised_block->label() . '?');
// Test breadcrumb.
$trail = [
'' => 'Home',
'block/' . $revised_block->id() => $revised_block->label(),
];
$this->assertBreadcrumb(
'block/' . $revised_block->id() . '/delete', $trail
);
} }
} }

View File

@ -2175,6 +2175,11 @@ parameters:
count: 2 count: 2
path: modules/system/tests/modules/entity_test/entity_test.install path: modules/system/tests/modules/entity_test/entity_test.install
-
message: "#^Variable \\$goto in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php
- -
message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#" message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
count: 1 count: 1