Issue #3374626 by lauriii, penyaskito, smustgrave, longwave: Comment type form title is confusing
parent
e983ee9d89
commit
95dcdb3f58
|
@ -135,7 +135,7 @@ entity.comment_type.edit_form:
|
|||
path: '/admin/structure/comment/manage/{comment_type}'
|
||||
defaults:
|
||||
_entity_form: 'comment_type.edit'
|
||||
_title: 'Edit'
|
||||
_title_callback: '\Drupal\Core\Entity\Controller\EntityController::title'
|
||||
requirements:
|
||||
_entity_access: 'comment_type.update'
|
||||
options:
|
||||
|
|
|
@ -74,6 +74,10 @@ class CommentTypeForm extends EntityForm {
|
|||
|
||||
$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'),
|
||||
|
|
|
@ -47,6 +47,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
parent::setUp();
|
||||
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
$this->drupalPlaceBlock('system_breadcrumb_block');
|
||||
|
||||
$this->adminUser = $this->drupalCreateUser($this->permissions);
|
||||
}
|
||||
|
@ -67,6 +68,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
// 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', "Edit {$comment_type->label()} comment type");
|
||||
|
||||
// Create a comment type via the user interface.
|
||||
$edit = [
|
||||
|
@ -81,6 +83,9 @@ class CommentTypeTest extends CommentTestBase {
|
|||
// 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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue