diff --git a/core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php b/core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php index 84ad4aab385a60e1c602173d34e0eea4221d3a84..7ff1fa5da5787043aa96f0616fc7af6c0dd49f05 100644 --- a/core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php +++ b/core/modules/content_moderation/src/Plugin/Derivative/DynamicLocalTasks.php @@ -78,11 +78,12 @@ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { if ($this->moderationInfo->canModerateEntitiesOfEntityType($entity_type)) { - $this->derivatives["$entity_type_id.moderation_tab"] = [ - 'route_name' => "entity.$entity_type_id.moderation", + $bundle_id = $entity_type->getBundleEntityType(); + $this->derivatives["$bundle_id.moderation_tab"] = [ + 'route_name' => "entity.$bundle_id.moderation", 'title' => $this->t('Manage moderation'), // @todo - are we sure they all have an edit_form? - 'base_route' => "entity.$entity_type_id.edit_form", + 'base_route' => "entity.$bundle_id.edit_form", 'weight' => 30, ] + $base_plugin_definition; } diff --git a/core/modules/content_moderation/src/Tests/ModerationStateBlockTest.php b/core/modules/content_moderation/src/Tests/ModerationStateBlockTest.php index 001d6b55ffad1e3304f365d192ea3da1c447717d..03a4b0ee2d91c1d389ceb3ce08a2d0f1732ed205 100644 --- a/core/modules/content_moderation/src/Tests/ModerationStateBlockTest.php +++ b/core/modules/content_moderation/src/Tests/ModerationStateBlockTest.php @@ -51,6 +51,12 @@ protected function setUp() { public function testCustomBlockModeration() { $this->drupalLogin($this->rootUser); + $this->drupalGet('admin/structure/block/block-content/types'); + $this->assertLinkByHref('admin/structure/block/block-content/manage/basic/moderation'); + $this->drupalGet('admin/structure/block/block-content/manage/basic'); + $this->assertLinkByHref('admin/structure/block/block-content/manage/basic/moderation'); + $this->drupalGet('admin/structure/block/block-content/manage/basic/moderation'); + // Enable moderation for custom blocks at // admin/structure/block/block-content/manage/basic/moderation. $edit = [ @@ -59,7 +65,7 @@ public function testCustomBlockModeration() { 'allowed_moderation_states_published[published]' => TRUE, 'default_moderation_state' => 'draft', ]; - $this->drupalPostForm('admin/structure/block/block-content/manage/basic/moderation', $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertText(t('Your settings have been saved.')); // Create a custom block at block/add and save it as draft. diff --git a/core/modules/content_moderation/src/Tests/ModerationStateTestBase.php b/core/modules/content_moderation/src/Tests/ModerationStateTestBase.php index 0dbdc3df3baa4e43140ba4bb1f7f685c6e54931c..ddd275e6e4b4aced022c3a7f8cda1f582ad92ece 100644 --- a/core/modules/content_moderation/src/Tests/ModerationStateTestBase.php +++ b/core/modules/content_moderation/src/Tests/ModerationStateTestBase.php @@ -108,6 +108,8 @@ protected function createContentTypeFromUi($content_type_name, $content_type_id, protected function enableModerationThroughUi($content_type_id, array $allowed_states, $default_state) { $this->drupalGet('admin/structure/types'); $this->assertLinkByHref('admin/structure/types/manage/' . $content_type_id . '/moderation'); + $this->drupalGet('admin/structure/types/manage/' . $content_type_id); + $this->assertLinkByHref('admin/structure/types/manage/' . $content_type_id . '/moderation'); $this->drupalGet('admin/structure/types/manage/' . $content_type_id . '/moderation'); $this->assertFieldByName('enable_moderation_state'); $this->assertNoFieldChecked('edit-enable-moderation-state');