diff --git a/composer.json b/composer.json index 413ae77840..b3722c81bf 100644 --- a/composer.json +++ b/composer.json @@ -282,6 +282,9 @@ "https://www.drupal.org/project/paragraphs_browser/issues/3381981": "https://www.drupal.org/files/issues/2023-08-22/3381981-sort-by-weight-4.patch", "https://www.drupal.org/project/paragraphs_browser/issues/3064852": "https://www.drupal.org/files/issues/2023-11-07/3064852-allow-hiding-browser-12.patch" }, + "drupal/paragraphs_features": { + "Add-in only works if active theme is claro or gin https://www.drupal.org/project/paragraphs_features/issues/3353704": "https://www.drupal.org/files/issues/2024-03-22/3353704-mr12-18.patch" + }, "drupal/redirect": { "https://www.drupal.org/project/redirect/issues/3057250": "https://www.drupal.org/files/issues/2024-08-11/redirect--2024-08-11--3057250-79.patch", "https://www.drupal.org/project/redirect/issues/3018897": "https://www.drupal.org/files/issues/2024-08-12/redirect-3018897-28.patch" diff --git a/config/default/core.entity_form_display.node.hs_basic_page.default.yml b/config/default/core.entity_form_display.node.hs_basic_page.default.yml index 632a01427f..ea27b16c36 100644 --- a/config/default/core.entity_form_display.node.hs_basic_page.default.yml +++ b/config/default/core.entity_form_display.node.hs_basic_page.default.yml @@ -9,6 +9,7 @@ dependencies: - field.field.node.hs_basic_page.layout_builder__layout - node.type.hs_basic_page module: + - field_formatter_class - menu_link - paragraphs - paragraphs_ee @@ -48,9 +49,11 @@ content: duplicate: duplicate expose_drag_drop: '1' third_party_settings: + field_formatter_class: + class: '' paragraphs_features: - add_in_between: false - add_in_between_link_count: 3 + add_in_between: true + add_in_between_link_count: 0 delete_confirmation: false show_drag_and_drop: true show_collapse_all: true @@ -58,6 +61,7 @@ content: paragraphs_ee: dialog_off_canvas: false dialog_style: tiles + drag_drop: false field_hs_page_hero: type: paragraphs weight: 1 @@ -79,9 +83,11 @@ content: duplicate: duplicate expose_drag_drop: '1' third_party_settings: + field_formatter_class: + class: '' paragraphs_features: - add_in_between: false - add_in_between_link_count: 3 + add_in_between: true + add_in_between_link_count: 0 delete_confirmation: false show_drag_and_drop: true show_collapse_all: true @@ -89,6 +95,7 @@ content: paragraphs_ee: dialog_off_canvas: false dialog_style: tiles + drag_drop: false field_menulink: type: menu_link_default weight: 26 diff --git a/config/default/core.entity_form_display.node.hs_private_page.default.yml b/config/default/core.entity_form_display.node.hs_private_page.default.yml index 49d3d1b8cc..cb9dade9f7 100644 --- a/config/default/core.entity_form_display.node.hs_private_page.default.yml +++ b/config/default/core.entity_form_display.node.hs_private_page.default.yml @@ -9,6 +9,7 @@ dependencies: - field.field.node.hs_private_page.layout_builder__layout - node.type.hs_private_page module: + - field_formatter_class - file - insert - menu_link @@ -46,10 +47,13 @@ content: collapse_edit_all: collapse_edit_all convert: '0' duplicate: duplicate + expose_drag_drop: '1' third_party_settings: + field_formatter_class: + class: '' paragraphs_features: - add_in_between: false - add_in_between_link_count: 3 + add_in_between: true + add_in_between_link_count: 0 delete_confirmation: false show_drag_and_drop: true show_collapse_all: true @@ -57,6 +61,7 @@ content: paragraphs_ee: dialog_off_canvas: false dialog_style: tiles + drag_drop: false field_menulink: type: menu_link_default weight: 26 diff --git a/docroot/modules/humsci/hs_paragraph_types/hs_paragraph_types.install b/docroot/modules/humsci/hs_paragraph_types/hs_paragraph_types.install index 012655950a..8c8f808c14 100644 --- a/docroot/modules/humsci/hs_paragraph_types/hs_paragraph_types.install +++ b/docroot/modules/humsci/hs_paragraph_types/hs_paragraph_types.install @@ -376,3 +376,32 @@ function hs_paragraph_types_update_10010() { $hs_priv_collection_style->delete(); } } + +/** + * Adds add between buttons to existing paragraphs. + */ +function hs_paragraph_types_update_10011() { + $fields = [ + 'field_hs_page_components' => 'node.hs_basic_page.default', + 'field_hs_page_hero' => 'node.hs_basic_page.default', + 'field_hs_priv_page_components' => 'node.hs_private_page.default', + ]; + $form_display_storage = \Drupal::entityTypeManager()->getStorage('entity_form_display'); + foreach ($fields as $field => $form_display_id) { + /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */ + $form_display = $form_display_storage->load($form_display_id); + if (empty($form_display)) { + continue; + } + + $component = $form_display->getComponent($field); + + if (empty($component)) { + continue; + } + $component['third_party_settings']['paragraphs_features']['add_in_between'] = 'true'; + $component['third_party_settings']['paragraphs_features']['add_in_between_link_count'] = 0; + $form_display->setComponent($field, $component) + ->save(); + } +} diff --git a/tests/codeception/functional/Install/Content/FlexiblePageCest.php b/tests/codeception/functional/Install/Content/FlexiblePageCest.php index 559d787002..26804fb83e 100644 --- a/tests/codeception/functional/Install/Content/FlexiblePageCest.php +++ b/tests/codeception/functional/Install/Content/FlexiblePageCest.php @@ -61,8 +61,8 @@ public function testDuplicateScroll(FunctionalTester $I) { 'type' => 'hs_basic_page', ]); $I->amOnPage($node->toUrl('edit-form')->toString()); - $I->scrollTo('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->scrollTo('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Collection'); $I->click('Collection', '.paragraphs-ee-add-dialog'); @@ -91,7 +91,7 @@ public function testHeroParagraph(FunctionalTester $I) { // Prevent JS alerts from firing before loading a new page. $I->executeJS('window.onbeforeunload = undefined;'); $I->fillField('Title', 'Demo Basic Page'); - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Banner'); $I->click('Banner image with full overlay and text', '.paragraphs-ee-add-dialog'); @@ -132,7 +132,7 @@ public function testPhotoAlbum(FunctionalTester $I) { // Prevent JS alerts from firing before loading a new page. $I->executeJS('window.onbeforeunload = undefined;'); $I->fillField('Title', 'Demo Basic Page'); - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Photo Album'); $I->click('Photo Album', '.paragraphs-ee-add-dialog'); @@ -158,7 +158,7 @@ public function testPhotoAlbum(FunctionalTester $I) { $I->canSeeNumberOfElements('#cboxContent img', 0); $I->waitForText('Edit'); $I->click('Edit', '.tabs'); - $I->click('field_hs_page_components_1_edit'); + $I->click('//input[@data-paragraphs-split-text-type="stanford_gallery"]/preceding::input[contains(@class, "paragraphs-icon-button-edit")][1]'); $I->waitForText('Content'); $I->scrollTo('Style'); $I->selectOption('Style', 'Slideshow'); @@ -236,7 +236,7 @@ public function testSpotlightSlider(FunctionalTester $I) { 'type' => 'hs_basic_page', ]); $I->amOnPage($node->toUrl('edit-form')->toString()); - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Spotlight'); $I->click('Spotlight(s)', '.paragraphs-ee-add-dialog'); @@ -308,7 +308,7 @@ public function testVerticalTimeline(FunctionalTester $I) { $I->logInWithRole('administrator'); $I->amOnPage('node/add/hs_basic_page'); $I->fillField('Title', $this->faker->words(3, TRUE)); - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Vertical Timeline'); $I->click('Vertical Timeline', '.paragraphs-ee-add-dialog'); @@ -352,7 +352,7 @@ public function testPostCard(FunctionalTester $I) { $I->logInWithRole('contributor'); $I->amOnPage('/node/add/hs_basic_page'); $I->fillField('Title', 'Demo Basic Page'); - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Postcard'); $I->click('Postcard', '.paragraphs-ee-add-dialog'); @@ -376,7 +376,7 @@ public function testAccordion(FunctionalTester $I) { $I->logInWithRole('contributor'); $I->amOnPage('/node/add/hs_basic_page'); $I->fillField('Title', 'Demo Basic Page'); - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'accordion'); $I->click('Accordion', '.paragraphs-ee-add-dialog'); @@ -405,7 +405,7 @@ public function testBackToTopExists(FunctionalTester $I) { } catch (\Exception $e) { // Add component if does not already exist. - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'text area'); $I->click('Text Area', '.paragraphs-ee-add-dialog'); @@ -446,7 +446,7 @@ public function testTextArea(FunctionalTester $I) { } catch (\Exception $e) { // Add component if does not already exist. - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'text area'); $I->click('Text Area', '.paragraphs-ee-add-dialog'); @@ -477,7 +477,7 @@ public function testCollections(FunctionalTester $I) { $I->amOnPage('/node/add/hs_basic_page'); $I->fillField('Title', 'Demo Basic Page'); // Add a Collection component to the page. - $I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Collection'); $I->click('Collection', '.paragraphs-ee-add-dialog'); diff --git a/tests/codeception/functional/Install/Content/PrivatePageContentCest.php b/tests/codeception/functional/Install/Content/PrivatePageContentCest.php index 5714ad1af0..6888ec4fd5 100644 --- a/tests/codeception/functional/Install/Content/PrivatePageContentCest.php +++ b/tests/codeception/functional/Install/Content/PrivatePageContentCest.php @@ -67,8 +67,8 @@ public function testPrivatePageContent(FunctionalTester $I) { $I->amOnPage('/node/add/hs_private_page'); $I->fillField('Title', 'Test Private Page'); foreach ($this->fieldsToCheck as $component => $component_info) { - $I->scrollTo('.field--name-field-priv-wysiwyg-files'); - $I->click('Add Component'); + $I->scrollTo('table[id^="field-hs-priv-page-components-values"] tr:last-child .paragraphs-features__add-in-between__button'); + $I->click('table[id^="field-hs-priv-page-components-values"] tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', $component); $I->click($component_info['component_button_name'], '.paragraphs-ee-add-dialog'); diff --git a/tests/codeception/functional/Install/Content/VideoEmbedCest.php b/tests/codeception/functional/Install/Content/VideoEmbedCest.php index 0db1a26a5f..85ff25a586 100644 --- a/tests/codeception/functional/Install/Content/VideoEmbedCest.php +++ b/tests/codeception/functional/Install/Content/VideoEmbedCest.php @@ -33,8 +33,7 @@ public function testVideoEmbed(FunctionalTester $I) { $I->fillField('Title', $this->faker->words(3, TRUE)); // Add text field. - $I->scrollTo('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more'); - $I->click('Add Component'); + $I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button'); $I->waitForText('Add Component'); $I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Text Area'); $I->click('Text Area', '.paragraphs-ee-add-dialog');