Commit 57bbb6f5 authored by alexpott's avatar alexpott

Issue #2788487 by timmillwood: Manage moderation tab not displaying on bundle admin

parent 437ebf7c
......@@ -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;
}
......
......@@ -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.
......
......@@ -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');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment