diff --git a/core/modules/block_content/block_content.routing.yml b/core/modules/block_content/block_content.routing.yml index 75ea9b2..37d9b71 100644 --- a/core/modules/block_content/block_content.routing.yml +++ b/core/modules/block_content/block_content.routing.yml @@ -79,6 +79,7 @@ entity.block_content_type.edit_form: path: '/admin/structure/block/block-content/manage/{block_content_type}' defaults: _entity_form: 'block_content_type.edit' + _title_callback: '\Drupal\Core\Entity\Controller\EntityController::title' requirements: _entity_access: 'block_content_type.update' diff --git a/core/modules/block_content/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php index e69394b..a4e3a21 100644 --- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php +++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php @@ -4,6 +4,8 @@ use Drupal\block_content\Entity\BlockContentType; use Drupal\Component\Utility\Html; +use Drupal\Core\Url; +use Drupal\system\Tests\Menu\AssertBreadcrumbTrait; /** * Ensures that custom block type functions work correctly. @@ -12,6 +14,7 @@ */ class BlockContentTypeTest extends BlockContentTestBase { + use AssertBreadcrumbTrait; /** * Modules to enable. * @@ -91,6 +94,7 @@ public function testBlockContentTypeCreation() { * Tests editing a block type using the UI. */ public function testBlockContentTypeEditing() { + $this->drupalPlaceBlock('system_breadcrumb_block'); // Now create an initial block-type. $this->createBlockContentType('basic', TRUE); @@ -113,6 +117,13 @@ public function testBlockContentTypeEditing() { $this->drupalGet('admin/structure/block/block-content/manage/basic'); $this->assertTitle(format_string('Edit @type custom block type | Drupal', ['@type' => 'basic'])); $this->drupalPostForm(NULL, $edit, t('Save')); + $front_page_path = Url::fromRoute('')->toString(); + $this->assertBreadcrumb('admin/structure/block/block-content/manage/basic/fields', [ + $front_page_path => 'Home', + 'admin/structure/block' => 'Block layout', + 'admin/structure/block/block-content' => 'Custom block library', + 'admin/structure/block/block-content/manage/basic' => 'Bar', + ]); \Drupal::entityManager()->clearCachedFieldDefinitions(); $this->drupalGet('block/add'); diff --git a/core/modules/node/node.routing.yml b/core/modules/node/node.routing.yml index 7c942a2..a016e3a 100644 --- a/core/modules/node/node.routing.yml +++ b/core/modules/node/node.routing.yml @@ -113,6 +113,7 @@ entity.node_type.edit_form: path: '/admin/structure/types/manage/{node_type}' defaults: _entity_form: 'node_type.edit' + _title_callback: '\Drupal\Core\Entity\Controller\EntityController::title' requirements: _permission: 'administer content types' diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php index d7ebf2b..e531064 100644 --- a/core/modules/node/src/Tests/NodeTypeTest.php +++ b/core/modules/node/src/Tests/NodeTypeTest.php @@ -5,6 +5,7 @@ use Drupal\field\Entity\FieldConfig; use Drupal\node\Entity\NodeType; use Drupal\Core\Url; +use Drupal\system\Tests\Menu\AssertBreadcrumbTrait; /** * Ensures that node type functions work correctly. @@ -13,12 +14,14 @@ */ class NodeTypeTest extends NodeTestBase { + use AssertBreadcrumbTrait; + /** * Modules to enable. * * @var array */ - public static $modules = ['field_ui']; + public static $modules = ['field_ui', 'block']; /** * Ensures that node type functions (node_type_get_*) work correctly. @@ -84,6 +87,7 @@ public function testNodeTypeCreation() { * Tests editing a node type using the UI. */ public function testNodeTypeEditing() { + $this->drupalPlaceBlock('system_breadcrumb_block'); $web_user = $this->drupalCreateUser(['bypass node access', 'administer content types', 'administer node fields']); $this->drupalLogin($web_user); @@ -134,6 +138,12 @@ public function testNodeTypeEditing() { $this->drupalPostForm('admin/structure/types/manage/page/fields/node.page.body/delete', [], t('Delete')); // Resave the settings for this type. $this->drupalPostForm('admin/structure/types/manage/page', [], t('Save content type')); + $front_page_path = Url::fromRoute('')->toString(); + $this->assertBreadcrumb('admin/structure/types/manage/page/fields', [ + $front_page_path => 'Home', + 'admin/structure/types' => 'Content types', + 'admin/structure/types/manage/page' => 'NewBar', + ]); // Check that the body field doesn't exist. $this->drupalGet('node/add/page'); $this->assertNoRaw('Body', 'Body field was not found.');