diff --git a/core/modules/comment/src/CommentTypeForm.php b/core/modules/comment/src/CommentTypeForm.php index 37b1bf973b..bdde416182 100644 --- a/core/modules/comment/src/CommentTypeForm.php +++ b/core/modules/comment/src/CommentTypeForm.php @@ -74,6 +74,10 @@ public function form(array $form, FormStateInterface $form_state) { $comment_type = $this->entity; + if ($this->operation == 'edit') { + $form['#title'] = $this->t('Edit %label comment type', ['%label' => $comment_type->label()]); + } + $form['label'] = [ '#type' => 'textfield', '#title' => $this->t('Label'), diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php index 225dd1fbfc..2e22b9e4ad 100644 --- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php @@ -47,6 +47,7 @@ protected function setUp(): void { parent::setUp(); $this->drupalPlaceBlock('page_title_block'); + $this->drupalPlaceBlock('system_breadcrumb_block'); $this->adminUser = $this->drupalCreateUser($this->permissions); } @@ -67,7 +68,7 @@ public function testCommentTypeCreation() { // Ensure that the new comment type admin page can be accessed. $this->drupalGet('admin/structure/comment/manage/' . $type->id()); $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->elementTextEquals('css', 'h1', $comment_type->label()); + $this->assertSession()->elementTextEquals('css', 'h1', "Edit {$comment_type->label()} comment type"); // Create a comment type via the user interface. $edit = [ @@ -82,6 +83,9 @@ public function testCommentTypeCreation() { // Asserts that form submit redirects to the expected manage fields page. $this->assertSession()->addressEquals('admin/structure/comment/manage/' . $edit['id'] . '/fields'); + // Asserts that the comment type is visible in breadcrumb. + $this->assertTrue($this->assertSession()->elementExists('css', 'nav[role="navigation"]')->hasLink('title for foo')); + $comment_type = CommentType::load('foo'); $this->assertInstanceOf(CommentType::class, $comment_type);