From e7018fc60df834495a91a98203d60b9fffb610f3 Mon Sep 17 00:00:00 2001 From: Joel Seguin <55501-joelseguin@users.noreply.drupalcode.org> Date: Thu, 16 Jan 2025 01:50:51 +0000 Subject: [PATCH 1/5] Added "Add content by bundle" button in view header --- .../config/views.view.person_profiles.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/recipes/drupal_cms_person/config/views.view.person_profiles.yml b/recipes/drupal_cms_person/config/views.view.person_profiles.yml index 83bb2485e..b0cace18f 100644 --- a/recipes/drupal_cms_person/config/views.view.person_profiles.yml +++ b/recipes/drupal_cms_person/config/views.view.person_profiles.yml @@ -5,6 +5,7 @@ dependencies: - core.entity_view_mode.node.card - node.type.person module: + - add_content_by_bundle - node - user id: person_profiles @@ -178,7 +179,23 @@ display: replica: false query_tags: { } relationships: { } - header: { } + header: + add_content_by_bundle: + id: add_content_by_bundle + table: views + field: add_content_by_bundle + relationship: none + group_type: group + admin_label: '' + plugin_id: add_content_by_bundle + label: 'Add a person' + empty: false + bundle: blog + class: button + target: '' + width: 600 + form_mode: null + params: '' footer: { } display_extenders: { } cache_metadata: -- GitLab From 7be399862a279106f73d80397a3449766dfbe868 Mon Sep 17 00:00:00 2001 From: Joel Seguin <55501-joelseguin@users.noreply.drupalcode.org> Date: Thu, 16 Jan 2025 13:17:12 +0000 Subject: [PATCH 2/5] Added dependencies; Updated button label to line up with the actual content type label; --- recipes/drupal_cms_person/composer.json | 1 + recipes/drupal_cms_person/config/views.view.person_profiles.yml | 2 +- recipes/drupal_cms_person/recipe.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/drupal_cms_person/composer.json b/recipes/drupal_cms_person/composer.json index 9b1e2bf5b..5f15d890c 100644 --- a/recipes/drupal_cms_person/composer.json +++ b/recipes/drupal_cms_person/composer.json @@ -5,6 +5,7 @@ "license": ["GPL-2.0-or-later"], "require": { "drupal/core": ">=10.4", + "drupal/add_content_by_bundle": "^1.2.2", "drupal/drupal_cms_page": "1.x-dev" } } diff --git a/recipes/drupal_cms_person/config/views.view.person_profiles.yml b/recipes/drupal_cms_person/config/views.view.person_profiles.yml index b0cace18f..ce040d409 100644 --- a/recipes/drupal_cms_person/config/views.view.person_profiles.yml +++ b/recipes/drupal_cms_person/config/views.view.person_profiles.yml @@ -188,7 +188,7 @@ display: group_type: group admin_label: '' plugin_id: add_content_by_bundle - label: 'Add a person' + label: 'Add a person profile' empty: false bundle: blog class: button diff --git a/recipes/drupal_cms_person/recipe.yml b/recipes/drupal_cms_person/recipe.yml index 30e386915..a34c83d5a 100644 --- a/recipes/drupal_cms_person/recipe.yml +++ b/recipes/drupal_cms_person/recipe.yml @@ -4,6 +4,7 @@ description: Adds a person profile content type. recipes: - drupal_cms_page install: + - add_content_by_bundle - menu_link_content - telephone config: -- GitLab From 73560b31f4f3e82be7dec054cc6a51324b92aa90 Mon Sep 17 00:00:00 2001 From: Joel Seguin <55501-joelseguin@users.noreply.drupalcode.org> Date: Thu, 16 Jan 2025 13:29:13 +0000 Subject: [PATCH 3/5] Added automated test for person content type; --- .../drupal_cms_starter/tests/src/Functional/ListingPagesTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/drupal_cms_starter/tests/src/Functional/ListingPagesTest.php b/recipes/drupal_cms_starter/tests/src/Functional/ListingPagesTest.php index c0be151e2..6e3be98c2 100644 --- a/recipes/drupal_cms_starter/tests/src/Functional/ListingPagesTest.php +++ b/recipes/drupal_cms_starter/tests/src/Functional/ListingPagesTest.php @@ -41,6 +41,7 @@ class ListingPagesTest extends BrowserTestBase { * ["drupal/drupal_cms_events", "event", "Events", "/events", "Add an event"] * ["drupal/drupal_cms_news", "news", "News", "/news", "Add a news item"] * ["drupal/drupal_cms_project", "project", "Projects", "/projects", "Add a project"] + * ["drupal/drupal_cms_person", "person", "People", "/people", "Add a person profile"] */ public function testListingPages(string $recipe, string $content_type, string $link_text, string $url, string $create_link_text): void { $dir = InstalledVersions::getInstallPath($recipe); -- GitLab From d716b2353481b29d373a5582ca9f07cec153492b Mon Sep 17 00:00:00 2001 From: Joel Seguin <55501-joelseguin@users.noreply.drupalcode.org> Date: Thu, 16 Jan 2025 14:00:09 +0000 Subject: [PATCH 4/5] Corrected wrong bundle for "Add Content by Bundle" button --- recipes/drupal_cms_person/config/views.view.person_profiles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/drupal_cms_person/config/views.view.person_profiles.yml b/recipes/drupal_cms_person/config/views.view.person_profiles.yml index ce040d409..d3067de0a 100644 --- a/recipes/drupal_cms_person/config/views.view.person_profiles.yml +++ b/recipes/drupal_cms_person/config/views.view.person_profiles.yml @@ -190,7 +190,7 @@ display: plugin_id: add_content_by_bundle label: 'Add a person profile' empty: false - bundle: blog + bundle: person class: button target: '' width: 600 -- GitLab From 8a95170dd08aca947b9ae3cb1885de28b5d41105 Mon Sep 17 00:00:00 2001 From: Joel Seguin <55501-joelseguin@users.noreply.drupalcode.org> Date: Thu, 16 Jan 2025 14:40:13 +0000 Subject: [PATCH 5/5] Updated Add Content by Bundle config based on other recipes (in order to pass tests) --- .../drupal_cms_person/config/views.view.person_profiles.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipes/drupal_cms_person/config/views.view.person_profiles.yml b/recipes/drupal_cms_person/config/views.view.person_profiles.yml index d3067de0a..d4b96dbf8 100644 --- a/recipes/drupal_cms_person/config/views.view.person_profiles.yml +++ b/recipes/drupal_cms_person/config/views.view.person_profiles.yml @@ -189,13 +189,11 @@ display: admin_label: '' plugin_id: add_content_by_bundle label: 'Add a person profile' - empty: false + empty: true bundle: person class: button target: '' width: 600 - form_mode: null - params: '' footer: { } display_extenders: { } cache_metadata: -- GitLab