diff --git a/config/sync/core.entity_form_display.node.custom_page.default.yml b/config/sync/core.entity_form_display.node.custom_page.default.yml index 53b25d53a7dda5b647449a86269ba2b1045c3738..70b7f6ac00bcc33c69c864d14eeb28671ff45a4b 100644 --- a/config/sync/core.entity_form_display.node.custom_page.default.yml +++ b/config/sync/core.entity_form_display.node.custom_page.default.yml @@ -13,6 +13,7 @@ dependencies: - file - image - paragraphs + - path id: node.custom_page.default targetEntityType: node bundle: custom_page @@ -59,6 +60,12 @@ content: settings: include_locked: true third_party_settings: { } + path: + type: path + weight: 7 + region: content + settings: { } + third_party_settings: { } status: type: boolean_checkbox weight: 6 @@ -83,7 +90,6 @@ hidden: created: true current_workflow_state: true og_audience: true - path: true promote: true published_at: true sticky: true diff --git a/tests/features/custom_page/custom_page.edit.feature b/tests/features/custom_page/custom_page.edit.feature index 6fabe0fa30d13158d850a725d675bb09a405effd..6da287bc49d97d3c4771ee0e4537164e629c1af4 100644 --- a/tests/features/custom_page/custom_page.edit.feature +++ b/tests/features/custom_page/custom_page.edit.feature @@ -31,12 +31,29 @@ Feature: "Custom page" editing. # A moderator can edit all custom pages. When I am logged in as a user with the moderator role And I go to the "Buena Vista Distribution Company" custom page - # Moderators have the 'administer nodes' permission. Then I should see the link "Edit" + When I click "Edit" + Then I should see the heading "Edit Custom page Buena Vista Distribution Company" + And the following fields should be present "Title, Body, Published" + And the following fields should not be present "Groups audience, Other groups, Generate automatic URL alias, URL alias" + And I should not see the following lines of text: + | Authored on | + | Create new revision | + | URL alias (Automatic alias) | + | Generate automatic URL alias | + | Uncheck this to create a custom alias below. | + | Groups audience | + | Other groups | + | Promoted to front page | + | Revision information | + | Revision log message | + | Sticky at top of lists | + # A normal logged in user should not be able to edit the custom page. When I am logged in as a user with the authenticated role And I go to the "Buena Vista Distribution Company" custom page Then I should not see the link "Edit" + # An anonymous user cannot edit the custom page. When I am logged in as a user with the authenticated role And I go to the "Buena Vista Distribution Company" custom page @@ -48,7 +65,21 @@ Feature: "Custom page" editing. And I click "Edit" Then I should see the heading "Edit Custom page Buena Vista Distribution Company" And the following fields should be present "Title, Body, Published" - And the following fields should not be present "Groups audience, Other groups" + And the following fields should not be present "Groups audience, Other groups, URL alias" + And the following fields should not be present "Groups audience, Other groups, Generate automatic URL alias, URL alias" + And I should not see the following lines of text: + | Authored on | + | Create new revision | + | URL alias (Automatic alias) | + | Generate automatic URL alias | + | Uncheck this to create a custom alias below. | + | Groups audience | + | Other groups | + | Promoted to front page | + | Revision information | + | Revision log message | + | Sticky at top of lists | + When I fill in "Title" with "Walt Disney Studios Motion Pictures" And I press "Save" Then I should have a "Custom page" content page titled "Walt Disney Studios Motion Pictures" diff --git a/tests/features/update/deploy_108900.feature b/tests/features/update/deploy_108900.feature new file mode 100644 index 0000000000000000000000000000000000000000..bc43364b28183c338b80c3e39f57b67273fa8d9a --- /dev/null +++ b/tests/features/update/deploy_108900.feature @@ -0,0 +1,15 @@ +@api @group-clone +Feature: Covers \joinup_core_deploy_108900(). + + Scenario: Test that news creation works. + + Given I am logged in as a moderator + And I am on the homepage + When I click "Interoperable Europe" + And I click "News" + Then the url should match "/interoperable-europe/latest-news" + + When I click "Add news" in the plus button menu + Then the response status code should be 200 + And the url should match "/interoperable-europe/news/add" + And I should see the heading "Add news" diff --git a/web/modules/custom/joinup_core/joinup_core.deploy.php b/web/modules/custom/joinup_core/joinup_core.deploy.php index 2b921d4eaefb781c5c54e80fe2a68f106819cf1a..6de171874d2cc455e2481bac456720acb54d6640 100644 --- a/web/modules/custom/joinup_core/joinup_core.deploy.php +++ b/web/modules/custom/joinup_core/joinup_core.deploy.php @@ -14,62 +14,16 @@ declare(strict_types = 1); -use Drupal\interoperable_europe\InteroperableEuropeCollectionInterface; +use Drupal\pathauto\PathautoState; /** - * Import new landing page. + * Fix Interoperable Europe news creation link. */ -function joinup_core_deploy_108800(): void { - /** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */ - $module_installer = \Drupal::service('module_installer'); - /** @var \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository */ - $entity_repository = \Drupal::service('entity.repository'); - - // Import new content. - $module_installer->install(['default_content']); - /** @var \Drupal\default_content\ImporterInterface $importer */ - \Drupal::service('default_content.importer')->importContent('interoperable_europe', TRUE); - $module_installer->uninstall(['default_content']); - - // Disable auto-created left-side menu link. - $landing_page = $entity_repository->loadEntityByUuid('node', '61e83391-9f96-4c9e-995d-9b22705b9f9f'); - $link_plugins = \Drupal::service('plugin.manager.menu.link')->loadLinksByRoute('entity.node.canonical', [ - 'node' => $landing_page->id(), - ], 'ogmenu-3600'); - /** @var \Drupal\menu_link_content\Plugin\Menu\MenuLinkContent $link_plugin */ - $link_plugin = reset($link_plugins); - $entity_repository - ->loadEntityByUuid('menu_link_content', $link_plugin->getDerivativeId()) - ->setUnpublished() - ->save(); - - // Remove old IOP landing page. - \Drupal::entityTypeManager()->getStorage('node')->load(704740)->delete(); -} - -/** - * Update path alias IOPE. - */ -function joinup_core_deploy_108801(): void { - /** @var \Drupal\collection\Entity\CollectionInterface $collection */ - $collection = \Drupal::entityTypeManager() - ->getStorage('rdf_entity') - ->load(InteroperableEuropeCollectionInterface::COLLECTION_ENTITY_ID); - - // Get all entities from IOPE. - $content = $collection->getGroupContentIds(); - - $collection->path = ['alias' => '/interoperable-europe', 'pathauto' => 0]; - $collection->save(); - - // Update entities in IOPE group. - foreach ($content as $type => $entities) { - foreach ($entities as $ids) { - foreach ($ids as $id) { - $entity = \Drupal::entityTypeManager()->getStorage($type)->load($id); - $entity->path = ['pathauto' => 1]; - $entity->save(); - } - } - } +function joinup_core_deploy_108900(): void { + $entityTypeManager = \Drupal::entityTypeManager(); + $entityTypeManager->getStorage('node')->load(704825)->set('path', [ + 'pathauto' => PathautoState::SKIP, + 'alias' => '/interoperable-europe/latest-news', + ])->save(); + $entityTypeManager->getStorage('path_alias')->load(84170)->delete(); }