diff --git a/composer.json b/composer.json index 82d7802bb..266933f4a 100644 --- a/composer.json +++ b/composer.json @@ -61,6 +61,7 @@ "drupal/pantheon_advanced_page_cache": "^2.2", "drupal/paragraphs": "^1.17", "drupal/paragraphs_edit": "^3.0", + "drupal/paragraphs_ee": "^10.0", "drupal/password_policy": "^4.0", "drupal/pathauto": "^1.12", "drupal/permissions_filter": "^1.3", diff --git a/composer.lock b/composer.lock index ffd9643b6..218ae83a9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "42ba1af779b3a90cae209d0afd96c4ec", + "content-hash": "7b45dbc163039bda18a3a82bd5fd04f3", "packages": [ { "name": "asm89/stack-cors", @@ -4425,6 +4425,125 @@ "source": "https://git.drupalcode.org/project/paragraphs_edit" } }, + { + "name": "drupal/paragraphs_ee", + "version": "10.0.5", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/paragraphs_ee.git", + "reference": "10.0.5" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/paragraphs_ee-10.0.5.zip", + "reference": "10.0.5", + "shasum": "a638c2a75804eb89e0934f159210a599267ee4a8" + }, + "require": { + "drupal/core": ">=10.0", + "drupal/paragraphs_features": "^2.0" + }, + "require-dev": { + "drupal/paragraphs_sets": "*", + "phpunit/phpunit": "^9.5", + "weitzman/drupal-test-traits": "^1.5" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "10.0.5", + "datestamp": "1729580104", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Stefan Borchert", + "homepage": "https://www.drupal.org/user/36942", + "email": "stefan.borchert@undpaul.de" + } + ], + "description": "Paragraphs Editor Enhancements for better usability.", + "homepage": "https://www.drupal.org/project/paragraphs_ee", + "support": { + "source": "https://git.drupalcode.org/project/paragraphs_ee" + } + }, + { + "name": "drupal/paragraphs_features", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/paragraphs_features.git", + "reference": "2.0.0" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/paragraphs_features-2.0.0.zip", + "reference": "2.0.0", + "shasum": "3f4856f2c6ade242855f5311ff26e8951b8a53a7" + }, + "require": { + "drupal/core": "^9.2 || ^10", + "drupal/paragraphs": "^1.13" + }, + "require-dev": { + "drupal/gin": "^3.0" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "2.0.0", + "datestamp": "1713956979", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Mladen Todorovic", + "homepage": "https://www.drupal.org/user/2103716", + "email": "mladen.todorovic@burda.com" + }, + { + "name": "Daniel Bosen", + "homepage": "https://www.drupal.org/user/404865", + "email": "daniel.bosen@burda.com" + }, + { + "name": "Christian Fritsch", + "homepage": "https://www.drupal.org/user/3511180", + "email": "christian.fritsch@burda.com" + }, + { + "name": "Volker Killesreiter", + "homepage": "https://www.drupal.org/user/57527", + "email": "volker.killesreiter@burda.com" + }, + { + "name": "Alex Pott", + "email": "alex.a.pott@gmail.com" + } + ], + "description": "Paragraphs features for extending paragraphs widget functionality.", + "homepage": "https://www.drupal.org/project/paragraphs_features", + "support": { + "source": "https://git.drupalcode.org/project/paragraphs_features" + } + }, { "name": "drupal/password_policy", "version": "4.0.3", diff --git a/config/sync/core.entity_form_display.node.landing_page.default.yml b/config/sync/core.entity_form_display.node.landing_page.default.yml index 9391aa62d..af1cacdf2 100644 --- a/config/sync/core.entity_form_display.node.landing_page.default.yml +++ b/config/sync/core.entity_form_display.node.landing_page.default.yml @@ -6,8 +6,12 @@ dependencies: - field.field.node.landing_page.field_is_title_hidden - field.field.node.landing_page.field_paragraphs - node.type.landing_page + - workflows.workflow.default module: + - content_moderation - paragraphs + - paragraphs_ee + - paragraphs_features - path id: node.landing_page.default targetEntityType: node @@ -35,17 +39,29 @@ content: title: Paragraph title_plural: Paragraphs edit_mode: closed - closed_mode: summary + closed_mode: preview autocollapse: none - closed_mode_threshold: 0 - add_mode: dropdown + closed_mode_threshold: 3 + add_mode: modal form_display_mode: default default_paragraph_type: _none features: - add_above: '0' + add_above: add_above collapse_edit_all: collapse_edit_all + convert: '0' duplicate: duplicate - third_party_settings: { } + third_party_settings: + paragraphs_ee: + paragraphs_ee: + dialog_off_canvas: false + dialog_style: tiles + drag_drop: true + paragraphs_features: + add_in_between: false + add_in_between_link_count: 3 + delete_confirmation: true + show_drag_and_drop: true + show_collapse_all: true langcode: type: language_select weight: 2 @@ -53,6 +69,12 @@ content: settings: include_locked: false third_party_settings: { } + moderation_state: + type: moderation_state_default + weight: 100 + region: content + settings: { } + third_party_settings: { } path: type: path weight: 6 diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 3e1347110..fa38fe54d 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -58,6 +58,7 @@ module: page_cache: 0 pantheon_advanced_page_cache: 0 paragraphs_edit: 0 + paragraphs_features: 0 password_policy_blacklist: 0 password_policy_character_types: 0 password_policy_length: 0 @@ -102,6 +103,7 @@ module: server_general: 10 views: 10 paragraphs: 11 + paragraphs_ee: 15 server: 1000 theme: stable: 0 diff --git a/config/sync/paragraphs_features.settings.yml b/config/sync/paragraphs_features.settings.yml new file mode 100644 index 000000000..3c6e286db --- /dev/null +++ b/config/sync/paragraphs_features.settings.yml @@ -0,0 +1,3 @@ +_core: + default_config_hash: lQErqdedK_5v01xVINKpMQnPQNpp4vS6oMsdNYbPfTI +dropdown_to_button: false diff --git a/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralHomepageTest.php b/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralHomepageTest.php index 2401f616b..87387d1f1 100644 --- a/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralHomepageTest.php +++ b/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralHomepageTest.php @@ -34,4 +34,46 @@ public function testHomeFeaturedContent() { $web_assert->elementTextContains('css', '.paragraph--type--related-content .carousel-slide.slick-current', 'Pandemic Moves Education Online'); } + /** + * Test the permissions and available paragraphs. + */ + public function testAddParagraph() { + $assert = $this->assertSession(); + // Login as a content editor. + $user = $this->createUser(); + $user->addRole('administrator'); + $user->save(); + $this->drupalLogin($user); + $this->drupalGet("/node/add/landing_page"); + + /** @var \Drupal\FunctionalJavascriptTests\JSWebAssert $web_assert */ + $web_assert = $this->assertSession(); + + $add_pagraph_button = $assert->elementExists('css', '.paragraph-type-add-modal-button'); + $this->assertNotNull($add_pagraph_button); + $add_pagraph_button->click(); + + $paragraph_types = [ + 'Accordion', + 'Call to action', + 'Documents', + 'Form', + 'Hero image', + 'Info cards', + 'News teasers', + 'People teasers', + 'Quick links', + 'Quote', + 'Related content', + 'Search', + 'Text', + ]; + // Wait half sec for the JS and animation. + $paragraphs = $web_assert->waitForElement('css', '.paragraphs-ee-add-dialog'); + $paragraphs_items = $paragraphs->findAll('css', '.paragraphs-label'); + foreach ($paragraphs_items as $label) { + $this->assertContains($label->getText(), $paragraph_types); + } + } + } diff --git a/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralNodeLandingPageTest.php b/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralNodeLandingPageTest.php index 3769648ce..675e21e3e 100644 --- a/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralNodeLandingPageTest.php +++ b/web/modules/custom/server_general/tests/src/ExistingSite/ServerGeneralNodeLandingPageTest.php @@ -33,35 +33,6 @@ public function getOptionalFields(): array { ]; } - /** - * Test the permissions and available paragraphs. - * - * @throws \Behat\Mink\Exception\ElementNotFoundException - * @throws \Drupal\Core\Entity\EntityStorageException - */ - public function testGeneral() { - $paragraph_types = [ - 'Hero image', - 'Related content', - 'Search', - 'Text', - 'News teasers', - ]; - - $assert = $this->assertSession(); - // Login as a content editor. - $user = $this->createUser(); - $user->addRole('administrator'); - $user->save(); - $this->drupalLogin($user); - $this->drupalGet("/node/add/landing_page"); - // Paragraph wrapper exists. - $assert->elementExists('css', '.field--name-field-paragraphs'); - foreach ($paragraph_types as $type) { - $assert->buttonExists("Add {$type}"); - } - } - /** * Test locked Homepage can't be deleted. */