diff --git a/core/modules/content_moderation/content_moderation.links.action.yml b/core/modules/content_moderation/content_moderation.links.action.yml index 9de50610552031c17d8be4c21959e97dfaf81642..cbb2d3fce04cb43e7c377c044c598eb5b5fe0612 100644 --- a/core/modules/content_moderation/content_moderation.links.action.yml +++ b/core/modules/content_moderation/content_moderation.links.action.yml @@ -1,11 +1,11 @@ entity.moderation_state.add_form: route_name: 'entity.moderation_state.add_form' - title: 'Add Moderation state' + title: 'Add moderation state' appears_on: - entity.moderation_state.collection entity.moderation_state_transition.add_form: route_name: 'entity.moderation_state_transition.add_form' - title: 'Add Moderation state transition' + title: 'Add moderation state transition' appears_on: - entity.moderation_state_transition.collection diff --git a/core/modules/content_moderation/content_moderation.routing.yml b/core/modules/content_moderation/content_moderation.routing.yml index cc7a5ff5d1e757592bf75f945a44ef9c10a365b6..912eed89fb8225ca4baa91078cd0e77b1907c2a0 100644 --- a/core/modules/content_moderation/content_moderation.routing.yml +++ b/core/modules/content_moderation/content_moderation.routing.yml @@ -5,69 +5,3 @@ content_moderation.overview: _title: 'Content moderation' requirements: _permission: 'access administration pages' - -# ModerationState routing definition -entity.moderation_state.collection: - path: '/admin/config/workflow/moderation/states' - defaults: - _entity_list: 'moderation_state' - _title: 'Moderation states' - requirements: - _permission: 'administer moderation states' - -entity.moderation_state.add_form: - path: '/admin/config/workflow/moderation/states/add' - defaults: - _entity_form: 'moderation_state.add' - _title: 'Add Moderation state' - requirements: - _permission: 'administer moderation states' - -entity.moderation_state.edit_form: - path: '/admin/config/workflow/moderation/states/{moderation_state}' - defaults: - _entity_form: 'moderation_state.edit' - _title: 'Edit Moderation state' - requirements: - _permission: 'administer moderation states' - -entity.moderation_state.delete_form: - path: '/admin/config/workflow/moderation/states/{moderation_state}/delete' - defaults: - _entity_form: 'moderation_state.delete' - _title: 'Delete Moderation state' - requirements: - _permission: 'administer moderation states' - -# ModerationStateTransition routing definition -entity.moderation_state_transition.collection: - path: '/admin/config/workflow/moderation/transitions' - defaults: - _entity_list: 'moderation_state_transition' - _title: 'Moderation state transitions' - requirements: - _permission: 'administer moderation state transitions' - -entity.moderation_state_transition.add_form: - path: '/admin/config/workflow/moderation/transitions/add' - defaults: - _entity_form: 'moderation_state_transition.add' - _title: 'Add Moderation state transition' - requirements: - _permission: 'administer moderation state transitions' - -entity.moderation_state_transition.edit_form: - path: '/admin/config/workflow/moderation/transitions/{moderation_state_transition}' - defaults: - _entity_form: 'moderation_state_transition.edit' - _title: 'Edit Moderation state transition' - requirements: - _permission: 'administer moderation state transitions' - -entity.moderation_state_transition.delete_form: - path: '/admin/config/workflow/moderation/transitions/{moderation_state_transition}/delete' - defaults: - _entity_form: 'moderation_state_transition.delete' - _title: 'Delete Moderation state transition' - requirements: - _permission: 'administer moderation state transitions' diff --git a/core/modules/content_moderation/src/Entity/ModerationState.php b/core/modules/content_moderation/src/Entity/ModerationState.php index 0522e7d6c7917774d0bb94f1ebc858ddbb2f26aa..379ff60d16be0f606a13d7189b956e085bcc9950 100644 --- a/core/modules/content_moderation/src/Entity/ModerationState.php +++ b/core/modules/content_moderation/src/Entity/ModerationState.php @@ -19,8 +19,12 @@ * "edit" = "Drupal\content_moderation\Form\ModerationStateForm", * "delete" = "Drupal\content_moderation\Form\ModerationStateDeleteForm" * }, + * "route_provider" = { + * "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider", + * }, * }, * config_prefix = "state", + * admin_permission = "administer moderation states", * entity_keys = { * "id" = "id", * "label" = "label", @@ -28,7 +32,8 @@ * "weight" = "weight", * }, * links = { - * "edit-form" = "/admin/config/workflow/moderation/states/{moderation_state}/edit", + * "add-form" = "/admin/config/workflow/moderation/states/add", + * "edit-form" = "/admin/config/workflow/moderation/states/{moderation_state}", * "delete-form" = "/admin/config/workflow/moderation/states/{moderation_state}/delete", * "collection" = "/admin/config/workflow/moderation/states" * }, diff --git a/core/modules/content_moderation/src/Entity/ModerationStateTransition.php b/core/modules/content_moderation/src/Entity/ModerationStateTransition.php index 99dbf93887886f4c0ae52a3230c29b04d3c6595a..95a115b962cf8a1b1ac1df8a676a3619e6046510 100644 --- a/core/modules/content_moderation/src/Entity/ModerationStateTransition.php +++ b/core/modules/content_moderation/src/Entity/ModerationStateTransition.php @@ -18,6 +18,9 @@ * "edit" = "Drupal\content_moderation\Form\ModerationStateTransitionForm", * "delete" = "Drupal\content_moderation\Form\ModerationStateTransitionDeleteForm" * }, + * "route_provider" = { + * "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider", + * }, * }, * config_prefix = "state_transition", * admin_permission = "administer moderation state transitions", @@ -28,7 +31,8 @@ * "weight" = "weight" * }, * links = { - * "edit-form" = "/admin/config/workflow/moderation/transitions/{moderation_state_transition}/edit", + * "add-form" = "/admin/config/workflow/moderation/transitions/add", + * "edit-form" = "/admin/config/workflow/moderation/transitions/{moderation_state_transition}", * "delete-form" = "/admin/config/workflow/moderation/transitions/{moderation_state_transition}/delete", * "collection" = "/admin/config/workflow/moderation/transitions" * } diff --git a/core/modules/content_moderation/src/ModerationStateAccessControlHandler.php b/core/modules/content_moderation/src/ModerationStateAccessControlHandler.php index cc2c977a3c1d78d819ad6f38edc3da2df1ceb10d..b2c86d7c727acc502ca44cd309f4cc46dc9ba0fd 100644 --- a/core/modules/content_moderation/src/ModerationStateAccessControlHandler.php +++ b/core/modules/content_moderation/src/ModerationStateAccessControlHandler.php @@ -18,7 +18,7 @@ class ModerationStateAccessControlHandler extends EntityAccessControlHandler { * {@inheritdoc} */ protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { - $admin_access = AccessResult::allowedIfHasPermission($account, 'administer moderation states'); + $admin_access = parent::checkAccess($entity, $operation, $account); // Allow view with other permission. if ($operation === 'view') { @@ -28,11 +28,4 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter return $admin_access; } - /** - * {@inheritdoc} - */ - protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'administer moderation states'); - } - } diff --git a/core/modules/content_moderation/src/Tests/ModerationStateStatesTest.php b/core/modules/content_moderation/src/Tests/ModerationStateStatesTest.php index 1b394f935c81f66038f80cee9901a7fd7e990276..3c5fd1471baba1ce576a930ca1cb50c16e2220d9 100644 --- a/core/modules/content_moderation/src/Tests/ModerationStateStatesTest.php +++ b/core/modules/content_moderation/src/Tests/ModerationStateStatesTest.php @@ -43,7 +43,7 @@ public function testStateAdministration() { $this->assertLink('Moderation states'); $this->assertLink('Moderation state transitions'); $this->clickLink('Moderation states'); - $this->assertLink('Add Moderation state'); + $this->assertLink('Add moderation state'); $this->assertText('Draft'); // Edit the draft. $this->clickLink('Edit', 0); @@ -59,7 +59,7 @@ public function testStateAdministration() { 'label' => 'Draft', ], t('Save')); $this->assertText('Saved the Draft Moderation state.'); - $this->clickLink(t('Add Moderation state')); + $this->clickLink(t('Add moderation state')); $this->drupalPostForm(NULL, [ 'label' => 'Expired', 'id' => 'expired', diff --git a/core/modules/content_moderation/src/Tests/ModerationStateTransitionsTest.php b/core/modules/content_moderation/src/Tests/ModerationStateTransitionsTest.php index 0495e48fa6c75350ec60eab952d5e152b90dbbcf..703561bf3d7f9219569e6eff5db88b8c7808224c 100644 --- a/core/modules/content_moderation/src/Tests/ModerationStateTransitionsTest.php +++ b/core/modules/content_moderation/src/Tests/ModerationStateTransitionsTest.php @@ -41,7 +41,7 @@ public function testTransitionAdministration() { $this->drupalGet('admin/config/workflow/moderation'); $this->clickLink('Moderation state transitions'); - $this->assertLink('Add Moderation state transition'); + $this->assertLink('Add moderation state transition'); $this->assertText('Create New Draft'); // Edit the Draft » Draft review. @@ -71,7 +71,7 @@ public function testTransitionAdministration() { // Add a new transition. $this->drupalGet('admin/config/workflow/moderation/transitions'); - $this->clickLink(t('Add Moderation state transition')); + $this->clickLink(t('Add moderation state transition')); $this->drupalPostForm(NULL, [ 'label' => 'Published » Expired', 'id' => 'published_expired',