diff --git a/config/sync/core.entity_form_display.node.guide_navigation.default.yml b/config/sync/core.entity_form_display.node.guide_navigation.default.yml
index 5bff3805..87d1277a 100644
--- a/config/sync/core.entity_form_display.node.guide_navigation.default.yml
+++ b/config/sync/core.entity_form_display.node.guide_navigation.default.yml
@@ -72,7 +72,7 @@ content:
third_party_settings: { }
field_parent_guide:
type: options_select
- weight: 14
+ weight: 26
region: content
settings: { }
third_party_settings: { }
diff --git a/config/sync/core.entity_form_display.node.guides.default.yml b/config/sync/core.entity_form_display.node.guides.default.yml
index e3885f7f..b361f9cb 100644
--- a/config/sync/core.entity_form_display.node.guides.default.yml
+++ b/config/sync/core.entity_form_display.node.guides.default.yml
@@ -19,7 +19,6 @@ dependencies:
- workflows.workflow.editorial
module:
- content_moderation
- - entity_reference_revisions
- field_group
- inline_entity_form
- maxlength
@@ -30,8 +29,8 @@ third_party_settings:
field_group:
group_guide_navigation:
children:
- - field_guide_nav_ref
- field_guide_nav_title
+ - field_guide_nav_ref
label: 'Guide Navigation'
region: content
parent_name: ''
@@ -85,14 +84,10 @@ content:
media_types: { }
third_party_settings: { }
field_guide_nav_ref:
- type: entity_reference_revisions_autocomplete
- weight: 17
+ type: options_select
+ weight: 26
region: content
- settings:
- match_operator: CONTAINS
- match_limit: 10
- size: 60
- placeholder: ''
+ settings: { }
third_party_settings: { }
field_guide_nav_title:
type: string_textfield
diff --git a/config/sync/core.entity_view_display.node.guide_navigation.default.yml b/config/sync/core.entity_view_display.node.guide_navigation.default.yml
index 9c476737..472fc86a 100644
--- a/config/sync/core.entity_view_display.node.guide_navigation.default.yml
+++ b/config/sync/core.entity_view_display.node.guide_navigation.default.yml
@@ -35,13 +35,20 @@ content:
third_party_settings: { }
weight: 1
region: content
+ field_parent_guide:
+ type: entity_reference_label
+ label: above
+ settings:
+ link: true
+ third_party_settings: { }
+ weight: 3
+ region: content
links:
settings: { }
third_party_settings: { }
weight: 0
region: content
hidden:
- field_parent_guide: true
field_show_in_page_nav: true
field_show_next_previous: true
field_show_read_time: true
diff --git a/config/sync/core.entity_view_display.node.guides.default.yml b/config/sync/core.entity_view_display.node.guides.default.yml
index 92eca1e8..fcd734b0 100644
--- a/config/sync/core.entity_view_display.node.guides.default.yml
+++ b/config/sync/core.entity_view_display.node.guides.default.yml
@@ -17,7 +17,6 @@ dependencies:
- field.field.node.guides.field_topics
- node.type.guides
module:
- - entity_reference_revisions
- text
- user
id: node.guides.default
@@ -30,19 +29,19 @@ content:
label: hidden
settings: { }
third_party_settings: { }
- weight: 101
+ weight: 2
region: content
content_moderation_control:
settings: { }
third_party_settings: { }
- weight: -20
+ weight: 0
region: content
field_deck:
type: text_default
label: above
settings: { }
third_party_settings: { }
- weight: 108
+ weight: 5
region: content
field_featured_image:
type: entity_reference_entity_view
@@ -51,33 +50,7 @@ content:
view_mode: default
link: false
third_party_settings: { }
- weight: 119
- region: content
- field_guide_nav_ref:
- type: entity_reference_revisions_entity_view
- label: above
- settings:
- view_mode: default
- link: ''
- third_party_settings: { }
- weight: 128
- region: content
- field_guide_nav_title:
- type: string
- label: above
- settings:
- link_to_entity: false
- third_party_settings: { }
- weight: 129
- region: content
- field_guide_weight:
- type: number_integer
- label: above
- settings:
- thousand_separator: ''
- prefix_suffix: true
- third_party_settings: { }
- weight: 127
+ weight: 8
region: content
field_kicker:
type: string
@@ -85,7 +58,7 @@ content:
settings:
link_to_entity: false
third_party_settings: { }
- weight: 116
+ weight: 7
region: content
field_page_weight:
type: number_integer
@@ -94,7 +67,7 @@ content:
thousand_separator: ''
prefix_suffix: true
third_party_settings: { }
- weight: 102
+ weight: 3
region: content
field_primary_image:
type: entity_reference_entity_view
@@ -103,24 +76,14 @@ content:
view_mode: default
link: false
third_party_settings: { }
- weight: 114
+ weight: 6
region: content
field_summary:
type: text_default
label: above
settings: { }
third_party_settings: { }
- weight: 104
- region: content
- field_summary_box:
- type: boolean
- label: above
- settings:
- format: default
- format_custom_false: ''
- format_custom_true: ''
- third_party_settings: { }
- weight: 126
+ weight: 4
region: content
field_topics:
type: entity_reference_label
@@ -128,11 +91,15 @@ content:
settings:
link: true
third_party_settings: { }
- weight: 125
+ weight: 9
region: content
links:
settings: { }
third_party_settings: { }
- weight: 100
+ weight: 1
region: content
-hidden: { }
+hidden:
+ field_guide_nav_ref: true
+ field_guide_nav_title: true
+ field_guide_weight: true
+ field_summary_box: true
diff --git a/config/sync/field.field.node.guide_navigation.field_guide_start_page.yml b/config/sync/field.field.node.guide_navigation.field_guide_start_page.yml
index b53c7cfe..b1c7a996 100644
--- a/config/sync/field.field.node.guide_navigation.field_guide_start_page.yml
+++ b/config/sync/field.field.node.guide_navigation.field_guide_start_page.yml
@@ -10,7 +10,7 @@ field_name: field_guide_start_page
entity_type: node
bundle: guide_navigation
label: 'Start Page'
-description: ''
+description: 'The page to use as the overview of the guide.'
required: true
translatable: false
default_value: { }
diff --git a/config/sync/field.field.node.guide_navigation.field_parent_guide.yml b/config/sync/field.field.node.guide_navigation.field_parent_guide.yml
index 8d3f7465..a5e3b579 100644
--- a/config/sync/field.field.node.guide_navigation.field_parent_guide.yml
+++ b/config/sync/field.field.node.guide_navigation.field_parent_guide.yml
@@ -1,18 +1,16 @@
-uuid: e3af469a-8b6e-415d-b333-659809ced01b
+uuid: 2e9e93c2-3d30-4a49-be9c-3124e243fda8
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_parent_guide
- node.type.guide_navigation
- module:
- - entity_reference_revisions
id: node.guide_navigation.field_parent_guide
field_name: field_parent_guide
entity_type: node
bundle: guide_navigation
label: 'Parent Guide'
-description: 'Add a link to this parent guide above title.'
+description: ''
required: false
translatable: false
default_value: { }
@@ -24,4 +22,4 @@ settings:
view_name: parent_guide_nav_pages_ref
display_name: entity_reference_1
arguments: { }
-field_type: entity_reference_revisions
+field_type: entity_reference
diff --git a/config/sync/field.field.node.guides.field_guide_nav_ref.yml b/config/sync/field.field.node.guides.field_guide_nav_ref.yml
index 8e0d6d7f..dcf66969 100644
--- a/config/sync/field.field.node.guides.field_guide_nav_ref.yml
+++ b/config/sync/field.field.node.guides.field_guide_nav_ref.yml
@@ -1,4 +1,4 @@
-uuid: cacc81a5-669e-4408-a688-bb694a693381
+uuid: c401a03f-21ab-4bdc-942a-ae789b8f255f
langcode: en
status: true
dependencies:
@@ -6,14 +6,12 @@ dependencies:
- field.storage.node.field_guide_nav_ref
- node.type.guide_navigation
- node.type.guides
- module:
- - entity_reference_revisions
id: node.guides.field_guide_nav_ref
field_name: field_guide_nav_ref
entity_type: node
bundle: guides
-label: 'Guide Nav'
-description: 'Select which guide navigation this page uses. Does not add the page to those links'
+label: 'Guide Navigation'
+description: ''
required: false
translatable: false
default_value: { }
@@ -28,4 +26,4 @@ settings:
direction: ASC
auto_create: false
auto_create_bundle: ''
-field_type: entity_reference_revisions
+field_type: entity_reference
diff --git a/config/sync/field.field.node.guides.field_kicker.yml b/config/sync/field.field.node.guides.field_kicker.yml
index 87149ffe..3bf711ce 100644
--- a/config/sync/field.field.node.guides.field_kicker.yml
+++ b/config/sync/field.field.node.guides.field_kicker.yml
@@ -10,7 +10,7 @@ field_name: field_kicker
entity_type: node
bundle: guides
label: Kicker
-description: 'Highlight the relevant topic. This displays above the title on the /gudes/ page. Should always be included. Use only one or two words.'
+description: 'Highlight the relevant topic. This displays above the title on the /guides/ page. Should always be included. Use only one or two words.'
required: false
translatable: false
default_value: { }
diff --git a/config/sync/field.storage.node.field_guide_nav_ref.yml b/config/sync/field.storage.node.field_guide_nav_ref.yml
index a8d016a1..57d4059a 100644
--- a/config/sync/field.storage.node.field_guide_nav_ref.yml
+++ b/config/sync/field.storage.node.field_guide_nav_ref.yml
@@ -1,17 +1,16 @@
-uuid: 89c0ef8f-af2c-4f5f-be55-02fb7af4aae9
+uuid: e9ed8dfb-c0e4-4831-b20c-05f3c719773a
langcode: en
status: true
dependencies:
module:
- - entity_reference_revisions
- node
id: node.field_guide_nav_ref
field_name: field_guide_nav_ref
entity_type: node
-type: entity_reference_revisions
+type: entity_reference
settings:
target_type: node
-module: entity_reference_revisions
+module: core
locked: false
cardinality: 1
translatable: true
diff --git a/config/sync/field.storage.node.field_parent_guide.yml b/config/sync/field.storage.node.field_parent_guide.yml
index 5fe531d4..6f784124 100644
--- a/config/sync/field.storage.node.field_parent_guide.yml
+++ b/config/sync/field.storage.node.field_parent_guide.yml
@@ -1,17 +1,16 @@
-uuid: 5d41c45a-d4cf-4357-b8dc-c950331793e2
+uuid: 71eab602-c462-4dec-95e7-2c7a234d9915
langcode: en
status: true
dependencies:
module:
- - entity_reference_revisions
- node
id: node.field_parent_guide
field_name: field_parent_guide
entity_type: node
-type: entity_reference_revisions
+type: entity_reference
settings:
target_type: node
-module: entity_reference_revisions
+module: core
locked: false
cardinality: 1
translatable: true
diff --git a/web/modules/custom/default_content_config/content/node/258cf431-4a0c-4489-807e-c87087c87cf9.yml b/web/modules/custom/default_content_config/content/node/258cf431-4a0c-4489-807e-c87087c87cf9.yml
new file mode 100644
index 00000000..514a0862
--- /dev/null
+++ b/web/modules/custom/default_content_config/content/node/258cf431-4a0c-4489-807e-c87087c87cf9.yml
@@ -0,0 +1,121 @@
+_meta:
+ version: '1.0'
+ entity_type: node
+ uuid: 258cf431-4a0c-4489-807e-c87087c87cf9
+ bundle: guide_navigation
+ default_langcode: en
+ depends:
+ 45a32394-3a9a-4481-a9bf-4701e39138ea: node
+ f0dc319d-abd2-4a06-bb17-1a9cd3ee3ad2: node
+ c4520a54-cd38-4be0-9158-24a61a79599e: node
+ b9c370f3-b204-4818-800d-660e366ebfea: node
+ 91b1798f-4dec-49d6-bfee-38ed0a4f5e49: node
+default:
+ revision_uid:
+ -
+ target_id: 1
+ status:
+ -
+ value: true
+ uid:
+ -
+ target_id: 1
+ title:
+ -
+ value: 'Test Guide Nav'
+ created:
+ -
+ value: 1734120032
+ promote:
+ -
+ value: false
+ sticky:
+ -
+ value: false
+ path:
+ -
+ alias: ''
+ langcode: en
+ pathauto: 0
+ field_guide_navigation:
+ -
+ entity:
+ _meta:
+ version: '1.0'
+ entity_type: paragraph
+ uuid: 18b88ea3-c9ac-436e-ac79-79a33caea223
+ bundle: guide_pages
+ default_langcode: en
+ default:
+ status:
+ -
+ value: true
+ created:
+ -
+ value: 1734120046
+ behavior_settings:
+ -
+ value: { }
+ field_guide_link:
+ -
+ entity: 45a32394-3a9a-4481-a9bf-4701e39138ea
+ -
+ entity:
+ _meta:
+ version: '1.0'
+ entity_type: paragraph
+ uuid: 21048a0c-5ff8-43c6-87cd-8fe32802938c
+ bundle: guide_pages
+ default_langcode: en
+ default:
+ status:
+ -
+ value: true
+ created:
+ -
+ value: 1734120046
+ behavior_settings:
+ -
+ value: { }
+ field_guide_link:
+ -
+ entity: f0dc319d-abd2-4a06-bb17-1a9cd3ee3ad2
+ -
+ entity:
+ _meta:
+ version: '1.0'
+ entity_type: paragraph
+ uuid: ec229ab5-d55b-4f98-a2b1-ad5a31d63c33
+ bundle: guide_pages
+ default_langcode: en
+ default:
+ status:
+ -
+ value: true
+ created:
+ -
+ value: 1734120051
+ behavior_settings:
+ -
+ value: { }
+ field_guide_link:
+ -
+ entity: c4520a54-cd38-4be0-9158-24a61a79599e
+ field_guide_subnav:
+ -
+ entity: b9c370f3-b204-4818-800d-660e366ebfea
+ field_guide_start_page:
+ -
+ entity: 91b1798f-4dec-49d6-bfee-38ed0a4f5e49
+ field_parent_guide:
+ -
+ entity: c4520a54-cd38-4be0-9158-24a61a79599e
+ field_show_in_page_nav:
+ -
+ value: true
+ field_show_next_previous:
+ -
+ value: true
+ field_show_read_time:
+ -
+ value: true
diff --git a/web/modules/custom/default_content_config/content/node/45a32394-3a9a-4481-a9bf-4701e39138ea.yml b/web/modules/custom/default_content_config/content/node/45a32394-3a9a-4481-a9bf-4701e39138ea.yml
index 49557b74..1eba3185 100644
--- a/web/modules/custom/default_content_config/content/node/45a32394-3a9a-4481-a9bf-4701e39138ea.yml
+++ b/web/modules/custom/default_content_config/content/node/45a32394-3a9a-4481-a9bf-4701e39138ea.yml
@@ -6,6 +6,7 @@ _meta:
default_langcode: en
depends:
c2eb37c0-02a5-4a36-90bc-a7039449b61b: media
+ 258cf431-4a0c-4489-807e-c87087c87cf9: node
1e945b0b-bcf5-4df7-9105-6c222eb70c13: media
default:
revision_uid:
@@ -49,6 +50,9 @@ default:
field_featured_image:
-
entity: c2eb37c0-02a5-4a36-90bc-a7039449b61b
+ field_guide_nav_ref:
+ -
+ entity: 258cf431-4a0c-4489-807e-c87087c87cf9
field_guide_weight:
-
value: 5
diff --git a/web/modules/custom/default_content_config/content/node/80caaa35-a22b-43ae-a72c-9a714c333a06.yml b/web/modules/custom/default_content_config/content/node/80caaa35-a22b-43ae-a72c-9a714c333a06.yml
index 34254ad6..dab5f75f 100644
--- a/web/modules/custom/default_content_config/content/node/80caaa35-a22b-43ae-a72c-9a714c333a06.yml
+++ b/web/modules/custom/default_content_config/content/node/80caaa35-a22b-43ae-a72c-9a714c333a06.yml
@@ -6,7 +6,6 @@ _meta:
default_langcode: en
depends:
bd7fedff-9767-49b3-8a71-8bab51265a86: node
- 3c8c1a7b-5b5b-4196-b435-1fa57ff0230b: node
6bd8641f-84c6-4ddb-b8b2-9c076b017198: media
default:
revision_uid:
@@ -83,9 +82,6 @@ default:
behavior_settings:
-
value: { }
- field_content:
- -
- entity: 3c8c1a7b-5b5b-4196-b435-1fa57ff0230b
field_title:
-
value: 'An introduction to accessibility'
diff --git a/web/modules/custom/default_content_config/content/node/91b1798f-4dec-49d6-bfee-38ed0a4f5e49.yml b/web/modules/custom/default_content_config/content/node/91b1798f-4dec-49d6-bfee-38ed0a4f5e49.yml
index 7da27725..28e0b14e 100644
--- a/web/modules/custom/default_content_config/content/node/91b1798f-4dec-49d6-bfee-38ed0a4f5e49.yml
+++ b/web/modules/custom/default_content_config/content/node/91b1798f-4dec-49d6-bfee-38ed0a4f5e49.yml
@@ -6,6 +6,7 @@ _meta:
default_langcode: en
depends:
cdc07606-1563-4772-9b45-11fa5d99c31a: media
+ 258cf431-4a0c-4489-807e-c87087c87cf9: node
default:
revision_uid:
-
@@ -45,6 +46,12 @@ default:
-
value: 'Use web analytics to reach your strategic website goals'
format: single_inline_html
+ field_featured_image:
+ -
+ entity: cdc07606-1563-4772-9b45-11fa5d99c31a
+ field_guide_nav_ref:
+ -
+ entity: 258cf431-4a0c-4489-807e-c87087c87cf9
field_guide_weight:
-
value: 1
diff --git a/web/modules/custom/default_content_config/content/node/c4520a54-cd38-4be0-9158-24a61a79599e.yml b/web/modules/custom/default_content_config/content/node/c4520a54-cd38-4be0-9158-24a61a79599e.yml
index 6beb03e3..c2c95242 100644
--- a/web/modules/custom/default_content_config/content/node/c4520a54-cd38-4be0-9158-24a61a79599e.yml
+++ b/web/modules/custom/default_content_config/content/node/c4520a54-cd38-4be0-9158-24a61a79599e.yml
@@ -5,6 +5,7 @@ _meta:
bundle: guides
default_langcode: en
depends:
+ 258cf431-4a0c-4489-807e-c87087c87cf9: node
b2f35ae8-423f-428b-865d-e420313e7a81: media
ad7aa7a5-33cf-400e-93cf-11820e467111: node
80caaa35-a22b-43ae-a72c-9a714c333a06: node
@@ -47,6 +48,9 @@ default:
-
value: 'A free analytics tool for measuring digital services in the federal government'
format: single_inline_html
+ field_guide_nav_ref:
+ -
+ entity: 258cf431-4a0c-4489-807e-c87087c87cf9
field_guide_weight:
-
value: 5
@@ -58,7 +62,7 @@ default:
entity: b2f35ae8-423f-428b-865d-e420313e7a81
field_summary:
-
- value: 'he Digital Analytics Program (DAP) offers advanced, easy web analytics for federal agencies.'
+ value: 'The Digital Analytics Program (DAP) offers advanced, easy web analytics for federal agencies.'
format: single_inline_html
field_summary_box:
-
diff --git a/web/modules/custom/default_content_config/content/node/cbcd65ff-8274-46c7-89bc-9f8c2bdaddd3.yml b/web/modules/custom/default_content_config/content/node/cbcd65ff-8274-46c7-89bc-9f8c2bdaddd3.yml
index 77013b42..bf3497f6 100644
--- a/web/modules/custom/default_content_config/content/node/cbcd65ff-8274-46c7-89bc-9f8c2bdaddd3.yml
+++ b/web/modules/custom/default_content_config/content/node/cbcd65ff-8274-46c7-89bc-9f8c2bdaddd3.yml
@@ -5,7 +5,6 @@ _meta:
bundle: resources
default_langcode: en
depends:
- 58b5051e-356e-4ace-be42-ca090259d6ab: node
80caaa35-a22b-43ae-a72c-9a714c333a06: node
default:
revision_uid:
@@ -54,7 +53,5 @@ default:
value: 'Introductory guidance on implementing privacy protections for users of federal websites.'
format: single_inline_html
field_topics:
- -
- entity: 58b5051e-356e-4ace-be42-ca090259d6ab
-
entity: 80caaa35-a22b-43ae-a72c-9a714c333a06
diff --git a/web/modules/custom/default_content_config/content/node/f0dc319d-abd2-4a06-bb17-1a9cd3ee3ad2.yml b/web/modules/custom/default_content_config/content/node/f0dc319d-abd2-4a06-bb17-1a9cd3ee3ad2.yml
index 54f4816e..e0aa1ad3 100644
--- a/web/modules/custom/default_content_config/content/node/f0dc319d-abd2-4a06-bb17-1a9cd3ee3ad2.yml
+++ b/web/modules/custom/default_content_config/content/node/f0dc319d-abd2-4a06-bb17-1a9cd3ee3ad2.yml
@@ -4,6 +4,8 @@ _meta:
uuid: f0dc319d-abd2-4a06-bb17-1a9cd3ee3ad2
bundle: guides
default_langcode: en
+ depends:
+ 258cf431-4a0c-4489-807e-c87087c87cf9: node
default:
revision_uid:
-
@@ -34,6 +36,9 @@ default:
alias: /guides/guide-all-required-fields
langcode: en
pathauto: 1
+ field_guide_nav_ref:
+ -
+ entity: 258cf431-4a0c-4489-807e-c87087c87cf9
field_summary:
-
value: 'A ‘quick-start’ guide for embedding accessibility and inclusive design practices into your team’s workflow'
diff --git a/web/themes/custom/digital_gov/digital_gov.theme b/web/themes/custom/digital_gov/digital_gov.theme
index 63b1cb44..29eaee6b 100644
--- a/web/themes/custom/digital_gov/digital_gov.theme
+++ b/web/themes/custom/digital_gov/digital_gov.theme
@@ -8,7 +8,10 @@
declare(strict_types=1);
use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Link;
use Drupal\Core\Template\Attribute;
+use Drupal\node\Entity\Node;
+use Drupal\paragraphs\Entity\Paragraph;
/**
* @file
@@ -37,6 +40,9 @@ function digital_gov_preprocess_node(array &$variables): void {
$created = DrupalDateTime::createFromTimestamp($variables['node']->getCreatedTime());
$variables['created'] = $created->format('M j, Y');
+ $site_config = \Drupal::config('system.site');
+ $variables['site_name'] = $site_config->get('name');
+
switch ($variables['node']->bundle()) {
case 'news':
$before_date = new DrupalDateTime('5 years ago');
@@ -55,7 +61,159 @@ function digital_gov_preprocess_node(array &$variables): void {
$variables['end_time'] = $endDate->format('g:i A T', ['timezone' => date_default_timezone_get()]);
}
break;
+
+ case 'guides':
+ digital_gov_preprocess_node_guides($variables);
+ break;
+ }
+}
+
+/**
+ * Preprocess function for guide nodes.
+ */
+function digital_gov_preprocess_node_guides(&$variables): void {
+ $guide = $variables['node'];
+ // Set defaults.
+ $variables['show_reading_time'] = FALSE;
+ $variables['show_next_previous'] = FALSE;
+ $variables['show_in_page_nav'] = FALSE;
+ $variables['is_guide_overview'] = FALSE;
+ $variables['show_summary_box'] = $guide->get('field_summary_box')[0]->get('value')->getCastedValue();
+
+ if (
+ ($nav_nid = (int) $guide->field_guide_nav_ref[0]?->target_id)
+ && $nav_node = Node::load($nav_nid)
+ ) {
+ $links = digital_gov_get_guidenav_links($nav_node, $variables['url']);
+ $variables = array_merge($variables, $links);
+
+ $variables['show_next_previous'] = $nav_node->field_show_next_previous?->value === "1";
+ $variables['show_reading_time'] = $nav_node->field_show_read_time?->value === "1";
+ $variables['show_in_page_nav'] = $nav_node->field_show_in_page_nav?->value === "1";
+ $variables['is_guide_overview'] = FALSE;
+
+ if ($links['guide_start_link']) {
+ $variables['is_guide_overview'] = ($variables['url'] === $links['guide_start_link']->getUrl()->toString());
+ }
+ }
+
+ if ($variables['show_reading_time']) {
+ // @todo Fix - where does reading time value come from?
+ $reading_time = 1;
+ $variables['reading_time'] = $reading_time . ' minute' . ($reading_time > 1 ? 's' : '');
+ }
+
+}
+
+/**
+ * Builds an array we can add to $variables with guide navigation info.
+ */
+function digital_gov_get_guidenav_links(Node $node, string $current): array {
+ // Anonymous helper for getting node links.
+ $makeLink = function (Node $page): Link {
+ return Link::createFromRoute(
+ // Override the navigation title if set in the node.
+ $page->get('field_guide_nav_title')?->get(0)?->getValue()
+ ?? $page->getTitle(),
+ 'entity.node.canonical',
+ ['node' => $page->id()]
+ );
+ };
+
+ // The guide_nav is an array that holds items with the following keys
+ // - 'link': A Link object the main link used the menu bar
+ // - 'subnav': an array of Link objects of links if the sidenav is shown.
+ $links['guide_nav'] = [];
+
+ if ($start_page = $node->get('field_guide_start_page')->first()->get('entity')->getTarget()->getValue()) {
+ $links['guide_start_node'] = $start_page;
+ $links['guide_start_link'] = $makeLink($start_page);
+ $links['guide_start_link']->setText(\t('Overview'));
+
+ // Assume this is open unless we find out otherwise later.
+ $links['guide_current_index'] = 0;
+ if ($featured_image = $start_page->get('field_featured_image')->first()->get('entity')->getTarget()->getValue()) {
+ $media = $featured_image->get('field_media_image')->first();
+ $links['guide_featured_image'] = $media;
+ }
+
+ $links['guide_nav'][] = ['link' => $links['guide_start_link']];
+ }
+
+ if ($parent_guide = $node->get('field_parent_guide')->first()->get('entity')->getValue()) {
+ $links['guide_parent_link'] = $makeLink($parent_guide);
}
+
+ if ($node->field_guide_navigation) {
+ // Generate the two-levels of nav links for this guide.
+ ;
+ foreach ($node->field_guide_navigation as $ref) {
+ // This field points at a paragraph entity.
+ $para = Paragraph::load($ref->target_revision_id);
+
+ if ($para->field_guide_link->target_id) {
+ $guidePage = $para->get('field_guide_link')->referencedEntities()[0];
+ if (!$guidePage->isPublished()) {
+ continue;
+ }
+
+ // Add the link to the navigation.
+ $link = $makeLink($guidePage);
+
+ $item['link'] = $link;
+
+ if ($para->field_guide_subnav) {
+ $subNavNodes = $para->get('field_guide_subnav')->referencedEntities();
+ $subNavNodes = array_filter($subNavNodes, fn(Node $node) => $node->isPublished());
+ if ($subNavNodes) {
+ $item['subnav'] = array_map($makeLink, $subNavNodes);
+ // If the current page is in the subnav, mark the parent as current.
+ $current_in_subnav = array_filter($item['subnav'], function (Link $subItem) use ($current) {
+ return $subItem->getUrl()->toString() === $current;
+ });
+ if ($current_in_subnav) {
+ // We haven't added our item to the guidenav, add 1 to the index.
+ $links['guide_current_index'] = isset($links['guide_nav']) ? array_key_last($links['guide_nav']) + 1 : 0;
+ }
+ }
+ }
+ $links['guide_nav'][] = $item;
+ if ($item['link']->getUrl()->toString() === $current) {
+ // Mark which top-level page is open.
+ $links['guide_current_index'] = array_key_last($links['guide_nav']);
+ }
+ }
+ }
+ }
+
+ // Here, figure out the next/previous links.
+ // We need a flat list of all the URLs in the guide nav keyed by URL.
+ $allTheUrls = [];
+ if ($links['guide_start_link']) {
+ $allTheUrls[$links['guide_start_link']->getUrl()->toString()] = $links['guide_start_link'];
+ }
+ array_walk_recursive(
+ $links['guide_nav'],
+ function ($link) use (&$allTheUrls) {
+ $allTheUrls[$link->getUrl()->toString()] = $link;
+ }
+ );
+
+ // $keyMap tells us what numeric slot each URL is found in.
+ $keyMap = array_keys($allTheUrls);
+ if ($allTheUrls && FALSE !== ($currentKey = array_search($current, $keyMap))) {
+ if (isset($keyMap[$currentKey - 1])) {
+ $prevKey = $keyMap[$currentKey - 1];
+ $links['guide_prev'] = $allTheUrls[$prevKey];
+ }
+
+ if (isset($keyMap[$currentKey + 1])) {
+ $nextKey = $keyMap[$currentKey + 1];
+ $links['guide_next'] = $allTheUrls[$nextKey];
+ }
+ }
+
+ return $links;
}
/**
diff --git a/web/themes/custom/digital_gov/js/summary-box.js b/web/themes/custom/digital_gov/js/summary-box.js
index ec6e24df..c374a2ed 100644
--- a/web/themes/custom/digital_gov/js/summary-box.js
+++ b/web/themes/custom/digital_gov/js/summary-box.js
@@ -17,7 +17,7 @@
* and filter out h2's we do not want to show with the :not selector
*/
const pageHeaders = document.querySelectorAll(
- "h2:not(.usa-summary-box__heading, .dg-guide__content-header-title, .dg-glossary__header)"
+ "h2:not(.usa-summary-box__heading, .dg-guide__content-header-title, .dg-glossary__header, .visually-hidden)"
);
/**
diff --git a/web/themes/custom/digital_gov/static/digitalgov/img/logos/digit-100.svg b/web/themes/custom/digital_gov/static/digitalgov/img/logos/digit-100.svg
new file mode 100644
index 00000000..cb0030a2
--- /dev/null
+++ b/web/themes/custom/digital_gov/static/digitalgov/img/logos/digit-100.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/web/themes/custom/digital_gov/static/digitalgov/img/logos/digitalgov-logo.svg b/web/themes/custom/digital_gov/static/digitalgov/img/logos/digitalgov-logo.svg
new file mode 100644
index 00000000..e3a006cc
--- /dev/null
+++ b/web/themes/custom/digital_gov/static/digitalgov/img/logos/digitalgov-logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/web/themes/custom/digital_gov/templates/field/field--node--field-summary--guides.html.twig b/web/themes/custom/digital_gov/templates/field/field--node--field-summary--guides.html.twig
new file mode 100644
index 00000000..f216be3c
--- /dev/null
+++ b/web/themes/custom/digital_gov/templates/field/field--node--field-summary--guides.html.twig
@@ -0,0 +1,46 @@
+{#
+/**
+ * @file
+ * Default theme implementation for a field.
+ *
+ * To override output, copy the "field.html.twig" from the templates directory
+ * to your theme's directory and customize it, just like customizing other
+ * Drupal templates such as page.html.twig or node.html.twig.
+ *
+ * Instead of overriding the theming for all fields, you can also just override
+ * theming for a subset of fields using
+ * @link themeable Theme hook suggestions. @endlink For example,
+ * here are some theme hook suggestions that can be used for a field_foo field
+ * on an article node type:
+ * - field--node--field-foo--article.html.twig
+ * - field--node--field-foo.html.twig
+ * - field--node--article.html.twig
+ * - field--field-foo.html.twig
+ * - field--text-with-summary.html.twig
+ * - field.html.twig
+ *
+ * Available variables:
+ * - attributes: HTML attributes for the containing element.
+ * - label_hidden: Whether to show the field label or not.
+ * - title_attributes: HTML attributes for the title.
+ * - label: The label for the field.
+ * - multiple: TRUE if a field can contain multiple items.
+ * - items: List of all the field items. Each item contains:
+ * - attributes: List of HTML attributes for each item.
+ * - content: The field item's content.
+ * - entity_type: The entity type to which the field belongs.
+ * - field_name: The name of the field.
+ * - field_type: The type of the field.
+ * - label_display: The display settings for the label.
+ *
+ * @see template_preprocess_field()
+ *
+ * @ingroup themeable
+ */
+#}
+
+{% for item in items %}
+
+{% endfor %}
diff --git a/web/themes/custom/digital_gov/templates/node/node--guides.html.twig b/web/themes/custom/digital_gov/templates/node/node--guides.html.twig
index 0ab44277..c6a84bb1 100644
--- a/web/themes/custom/digital_gov/templates/node/node--guides.html.twig
+++ b/web/themes/custom/digital_gov/templates/node/node--guides.html.twig
@@ -65,23 +65,21 @@
#}
- {{ include('@digital_gov/partials/guides/guide-header.html.twig') }}
-
- {# NOT - MIGRATED
- {-- partial "core/guides/guide-menu-bar.html" . -}
- #}
- {# NOT - MIGRATED
- {% if .Params.guide %}
- {{ $guideData = index $.Site.Data.guidenav (.Params.guide) }}
+ {% if (guide_start_node) %}
+ {{ include('@digital_gov/partials/guides/guide-header.html.twig', {
+ node: guide_start_node,
+ parent_link: guide_parent_link,
+ featured_image: guide_featured_image,
+ }, with_context=false)
+ }}
{% endif %}
- #}
- {% if guideData.showInPageNav %}
+ {{ include('@digital_gov/partials/guides/guide-menu-bar.html.twig') }}
+
+ {% if show_in_page_nav %}
{{ include('@digital_gov/partials/guides/guide-content.html.twig') }}
diff --git a/web/themes/custom/digital_gov/templates/partials/guides/guide-content.html.twig b/web/themes/custom/digital_gov/templates/partials/guides/guide-content.html.twig
index b0172a31..ebce9bfc 100644
--- a/web/themes/custom/digital_gov/templates/partials/guides/guide-content.html.twig
+++ b/web/themes/custom/digital_gov/templates/partials/guides/guide-content.html.twig
@@ -1,20 +1,73 @@
- [placeholder Guide Content Header]
- {# NOT-MIGRATED
- {{ partial "core/guides/guide-content-header.html" . }}
- #}
+
+
- {{ content }}
+ {{ content.body }}