From c08d3f3d3f8d7789787063ea907cd1c1f759d8f1 Mon Sep 17 00:00:00 2001 From: christian medders Date: Fri, 20 Dec 2024 13:23:27 -0500 Subject: [PATCH 1/6] DIGITAL-233: Tiwg template for homepage --- .../node--landing-page--homepage.html.twig | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig diff --git a/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig b/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig new file mode 100644 index 00000000..8f8b186c --- /dev/null +++ b/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig @@ -0,0 +1,144 @@ +{# +/** + * @file + * Default theme implementation to display a node. + * + * Available variables: + * - node: The node entity with limited access to object properties and methods. + * Only method names starting with "get", "has", or "is" and a few common + * methods such as "id", "label", and "bundle" are available. For example: + * - node.getCreatedTime() will return the node creation timestamp. + * - node.hasField('field_example') returns TRUE if the node bundle includes + * field_example. (This does not indicate the presence of a value in this + * field.) + * - node.isPublished() will return whether the node is published or not. + * Calling other methods, such as node.delete(), will result in an exception. + * See \Drupal\node\Entity\Node for a full list of public properties and + * methods for the node object. + * - label: (optional) The title of the node. + * - content: All node items. Use {{ content }} to print them all, + * or print a subset such as {{ content.field_example }}. Use + * {{ content|without('field_example') }} to temporarily suppress the printing + * of a given child element. + * - author_picture: The node author user entity, rendered using the "compact" + * view mode. + * - metadata: Metadata for this node. + * - date: (optional) Themed creation date field. + * - author_name: (optional) Themed author name field. + * - url: Direct URL of the current node. + * - display_submitted: Whether submission information should be displayed. + * - attributes: HTML attributes for the containing element. + * The attributes.class element may contain one or more of the following + * classes: + * - node: The current template type (also known as a "theming hook"). + * - node--type-[type]: The current node type. For example, if the node is an + * "Article" it would result in "node--type-article". Note that the machine + * name will often be in a short form of the human readable label. + * - node--view-mode-[view_mode]: The View Mode of the node; for example, a + * teaser would result in: "node--view-mode-teaser", and + * full: "node--view-mode-full". + * The following are controlled through the node publishing options. + * - node--promoted: Appears on nodes promoted to the front page. + * - node--sticky: Appears on nodes ordered above other non-sticky nodes in + * teaser listings. + * - node--unpublished: Appears on unpublished nodes visible only to site + * admins. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - content_attributes: Same as attributes, except applied to the main + * content tag that appears in the template. + * - author_attributes: Same as attributes, except applied to the author of + * the node tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * - view_mode: View mode; for example, "teaser" or "full". + * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'. + * - page: Flag for the full page state. Will be true if view_mode is 'full'. + * + * @see template_preprocess_node() + * + * @ingroup themeable + */ +#} + +
+ {#
#} + + + + {# Digital.gov Communities of Practice #} +
+ {{ drupal_view('featured_communities', 'default') }} +
+ + [Place holder for news list] + +{# NOT-MIGRATED +{{/* News */}} +{{- partialCached "core/home/news_featured.html" . -}} #} + + + {#
#} +
From 67d57c4d60f8a195ea991a94b24028fe5c4433c8 Mon Sep 17 00:00:00 2001 From: christian medders Date: Fri, 20 Dec 2024 13:25:18 -0500 Subject: [PATCH 2/6] DIGITAL-233: Export content for new homepage --- .../df0e2d62-c293-42be-8165-84542c35129d.yml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 web/modules/custom/default_content_config/content/node/df0e2d62-c293-42be-8165-84542c35129d.yml diff --git a/web/modules/custom/default_content_config/content/node/df0e2d62-c293-42be-8165-84542c35129d.yml b/web/modules/custom/default_content_config/content/node/df0e2d62-c293-42be-8165-84542c35129d.yml new file mode 100644 index 00000000..7d1dfcb2 --- /dev/null +++ b/web/modules/custom/default_content_config/content/node/df0e2d62-c293-42be-8165-84542c35129d.yml @@ -0,0 +1,39 @@ +_meta: + version: '1.0' + entity_type: node + uuid: df0e2d62-c293-42be-8165-84542c35129d + bundle: landing_page + default_langcode: en +default: + revision_uid: + - + target_id: 1 + status: + - + value: true + uid: + - + target_id: 1 + title: + - + value: 'Better websites. Better government.' + created: + - + value: 1734639806 + promote: + - + value: false + sticky: + - + value: false + moderation_state: + - + value: published + path: + - + alias: /better-websites-better-government-0 + langcode: en + pathauto: 1 + field_landing_page_type: + - + value: homepage From 6d83e17acb8b015c7d643d46da150009416eb15e Mon Sep 17 00:00:00 2001 From: christian medders Date: Fri, 20 Dec 2024 13:42:32 -0500 Subject: [PATCH 3/6] DIGITAL-233: Linting fixes --- .../node--landing-page--homepage.html.twig | 106 +++++++++--------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig b/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig index 8f8b186c..611481d0 100644 --- a/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig +++ b/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig @@ -64,34 +64,34 @@ #}
- {#
#} -
+ + {# Digital.gov Communities of Practice #} +
+ {{ drupal_view('featured_communities', 'default') }} +
- {# Digital.gov Communities of Practice #} -
- {{ drupal_view('featured_communities', 'default') }} -
- - [Place holder for news list] + [Place holder for news list] {# NOT-MIGRATED {{/* News */}} {{- partialCached "core/home/news_featured.html" . -}} #} - - {# #} + {# #}
From 2f84907e7f833834a57de3f05c339e8ef0255d09 Mon Sep 17 00:00:00 2001 From: christian medders Date: Thu, 2 Jan 2025 13:42:37 -0500 Subject: [PATCH 4/6] DIGITAL-233: Update to twig file and default content --- ...d.storage.node.field_landing_page_type.yml | 3 ++ .../df0e2d62-c293-42be-8165-84542c35129d.yml | 11 ++++- .../node--landing-page--homepage.html.twig | 44 +++++++++---------- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/config/sync/field.storage.node.field_landing_page_type.yml b/config/sync/field.storage.node.field_landing_page_type.yml index 82c3bd87..4ba0c49f 100644 --- a/config/sync/field.storage.node.field_landing_page_type.yml +++ b/config/sync/field.storage.node.field_landing_page_type.yml @@ -29,6 +29,9 @@ settings: - value: resources label: Resources + - + value: homepage + label: Homepage allowed_values_function: '' module: options locked: false diff --git a/web/modules/custom/default_content_config/content/node/df0e2d62-c293-42be-8165-84542c35129d.yml b/web/modules/custom/default_content_config/content/node/df0e2d62-c293-42be-8165-84542c35129d.yml index 7d1dfcb2..33afcc11 100644 --- a/web/modules/custom/default_content_config/content/node/df0e2d62-c293-42be-8165-84542c35129d.yml +++ b/web/modules/custom/default_content_config/content/node/df0e2d62-c293-42be-8165-84542c35129d.yml @@ -31,9 +31,18 @@ default: value: published path: - - alias: /better-websites-better-government-0 + alias: /better-websites-better-government langcode: en pathauto: 1 + field_buttons: + - + uri: 'internal:/events' + title: 'View Events' + options: { } + - + uri: 'internal:/communities' + title: 'Join Communities' + options: { } field_landing_page_type: - value: homepage diff --git a/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig b/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig index 611481d0..05f4fed2 100644 --- a/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig +++ b/web/themes/custom/digital_gov/templates/node/node--landing-page--homepage.html.twig @@ -74,39 +74,35 @@

{{ node.title.value }}

- - View Events - - - - Join Communities - - + {% set links = content.field_buttons|field_value %} + {% for link in links %} + + {{ link['#title'] }} + + + {% endfor %} -
[Place holder for resources list] - {# NOT-MIGRATED - {{/* Get all of the resources */}} - {{- $resources := (where .Site.Pages.ByTitle "Section" "resources") -}} - {{- $guides := (where .Site.Pages.ByTitle "Section" "guides") -}} + {# NOT-MIGRATED + {{/* Get all of the resources */}} + {{- $resources := (where .Site.Pages.ByTitle "Section" "resources") -}} + {{- $guides := (where .Site.Pages.ByTitle "Section" "guides") -}} - {{/* Get only the pages that are greater than or equal to 3 */}} - {{- $resourcesfeatured := (where $resources ".Params.weight" "ge" 3 ) -}} - {{- $guidesfeatured := (where $guides ".Params.weight" "ge" 6 ) -}} + {{/* Get only the pages that are greater than or equal to 3 */}} + {{- $resourcesfeatured := (where $resources ".Params.weight" "ge" 3 ) -}} + {{- $guidesfeatured := (where $guides ".Params.weight" "ge" 6 ) -}} - {{- $allFeatured := union $resourcesfeatured $guidesfeatured -}} + {{- $allFeatured := union $resourcesfeatured $guidesfeatured -}} - {{/* Sort all of the resources by weight */}} - {{- $resourcesfeatured := (sort $allFeatured "Weight" "desc" ) -}} + {{/* Sort all of the resources by weight */}} + {{- $resourcesfeatured := (sort $allFeatured "Weight" "desc" ) -}} - {{- partialCached "core/featured-collection.html" (dict "list" $resourcesfeatured "heading" "How to implement 21st Century IDEA") -}} #} + {{- partialCached "core/featured-collection.html" (dict "list" $resourcesfeatured "heading" "How to implement 21st Century IDEA") -}} #}