From 45d2dbf244713384a4e8ed68070e9080f682731a Mon Sep 17 00:00:00 2001
From: Edmund Dunn <109987005+edmund-dunn@users.noreply.github.com>
Date: Thu, 27 Feb 2025 13:37:35 -0800
Subject: [PATCH 1/9] VACMS-20599: update va-gov/content-build (#20725)
---
composer.json | 2 +-
composer.lock | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/composer.json b/composer.json
index 4f33b24e4d..150adfc911 100644
--- a/composer.json
+++ b/composer.json
@@ -228,7 +228,7 @@
"symfony/phpunit-bridge": "^7.1",
"symfony/process": "^6.3",
"symfony/routing": "^6.3",
- "va-gov/content-build": "0.0.3687",
+ "va-gov/content-build": "^0.0.3692",
"vlucas/phpdotenv": "^5.6",
"webflo/drupal-finder": "1.3.1",
"webmozart/path-util": "^2.3",
diff --git a/composer.lock b/composer.lock
index c2985a0171..7ff1241f64 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": "ada32d5f69e1bd4e9ecb9d0277032bfc",
+ "content-hash": "925bf2cf10cc9ee4a3dccb0375811f80",
"packages": [
{
"name": "asm89/stack-cors",
@@ -26907,16 +26907,16 @@
},
{
"name": "va-gov/content-build",
- "version": "v0.0.3687",
+ "version": "v0.0.3692",
"source": {
"type": "git",
"url": "https://github.com/department-of-veterans-affairs/content-build.git",
- "reference": "5cb5b37f4bfadd218e32bce98e0caa6b235d518e"
+ "reference": "c068208c8015cc7fbab3e7598356b2eda483c5fc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/department-of-veterans-affairs/content-build/zipball/5cb5b37f4bfadd218e32bce98e0caa6b235d518e",
- "reference": "5cb5b37f4bfadd218e32bce98e0caa6b235d518e",
+ "url": "https://api.github.com/repos/department-of-veterans-affairs/content-build/zipball/c068208c8015cc7fbab3e7598356b2eda483c5fc",
+ "reference": "c068208c8015cc7fbab3e7598356b2eda483c5fc",
"shasum": ""
},
"type": "node-project",
@@ -26943,9 +26943,9 @@
"description": "Front-end for VA.gov. This repository contains the code that generates the www.va.gov website. It contains a Metalsmith static site builder that uses a Drupal CMS for content. This file is here to publish releases to https://packagist.org/packages/va-gov/content-build, so that the CMS CI system can install it and update it using standard composer processes, and so that we can run tests across both systems. See https://github.com/department-of-veterans-affairs/va.gov-cms for the CMS repo, and stand by for more documentation.",
"support": {
"issues": "https://github.com/department-of-veterans-affairs/content-build/issues",
- "source": "https://github.com/department-of-veterans-affairs/content-build/tree/v0.0.3687"
+ "source": "https://github.com/department-of-veterans-affairs/content-build/tree/v0.0.3692"
},
- "time": "2025-02-19T16:18:39+00:00"
+ "time": "2025-02-26T22:06:38+00:00"
},
{
"name": "vlucas/phpdotenv",
From c9408100f63ca9c0f10f84546c80519b8309b961 Mon Sep 17 00:00:00 2001
From: Ryan Koch <6863534+ryguyk@users.noreply.github.com>
Date: Thu, 27 Feb 2025 17:03:56 -0600
Subject: [PATCH 2/9] VAGOV-TEAM-103554: View-form page (#20710)
* Adds route for view-form page.
* - Adds theme entries for view-form page.
- Refactors theme entries for non-editable-pattern pages.
* - Updates controller methods to align with refactored themes.
- Adds controller method for viewForm page that has two variations: available/unavailable.
* - Creates `base` directory for parent page-content templates.
- Refactors exist templates to extend these base templates where applicable.
- Removes prefixes from template names.
* Updates tests to align with new button ids.
* Adds functional test for view-form page.
* Changes "one-column-with-buttons" to "single-column-with-buttons".
* Adds library/css for single-column-with-buttons pages.
* Updates controller tests to add test for viewForm method.
* - Removes unnecessary prefixes on libraries.
- Changes snake_case to kebab-case for css files to match most of rest of directory structure.
---
.../{form_builder.css => form-builder.css} | 0
.../css/{form_info.css => form-info.css} | 0
...e_pattern.css => non-editable-pattern.css} | 0
.../css/single-column-with-buttons.css | 3 +
.../{phone-and-email.png => contact-info.png} | Bin
.../Controller/VaGovFormBuilderController.php | 163 +++++++++++---
.../page-content/address-info.html.twig | 5 +
.../non-editable-pattern.html.twig | 32 +--
.../base/single-column-with-buttons.html.twig | 34 +++
.../page-content/contact-info.html.twig | 5 +
...builder--home.html.twig => home.html.twig} | 2 -
.../identification-info.html.twig | 16 ++
...der--layout.html.twig => layout.html.twig} | 2 +-
.../page-content/name-and-dob.html.twig | 5 +
...a-gov-form-builder--address-info.html.twig | 7 -
...a-gov-form-builder--contact-info.html.twig | 7 -
...orm-builder--identification-info.html.twig | 8 -
...a-gov-form-builder--name-and-dob.html.twig | 8 -
...ov-form-builder--review-and-sign.html.twig | 21 --
.../page-content/review-and-sign.html.twig | 18 ++
.../view-form--available.html.twig | 11 +
.../view-form--unavailable.html.twig | 10 +
.../va_gov_form_builder.libraries.yml | 21 +-
.../va_gov_form_builder.module | 68 ++++--
.../va_gov_form_builder.routing.yml | 4 +
.../VaGovFormBuilderControllerTest.php | 147 ++++++++-----
.../content-pages/AddressInfoTest.php | 2 +-
.../content-pages/ContactInfoTest.php | 2 +-
.../content-pages/IdentificationInfoTest.php | 4 +-
.../content-pages/NameAndDobTest.php | 4 +-
.../content-pages/ReviewAndSignTest.php | 2 +-
.../functional/content-pages/ViewFormTest.php | 101 +++++++++
.../unit/LibrariesTest.php | 37 ++--
.../va_gov_form_builder/unit/ModuleTest.php | 207 +++++++++++-------
34 files changed, 656 insertions(+), 300 deletions(-)
rename docroot/modules/custom/va_gov_form_builder/css/{form_builder.css => form-builder.css} (100%)
rename docroot/modules/custom/va_gov_form_builder/css/{form_info.css => form-info.css} (100%)
rename docroot/modules/custom/va_gov_form_builder/css/{page_content__layout__non_editable_pattern.css => non-editable-pattern.css} (100%)
create mode 100644 docroot/modules/custom/va_gov_form_builder/css/single-column-with-buttons.css
rename docroot/modules/custom/va_gov_form_builder/images/{phone-and-email.png => contact-info.png} (100%)
create mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/address-info.html.twig
rename docroot/modules/custom/va_gov_form_builder/templates/page-content/{layout => base}/non-editable-pattern.html.twig (50%)
create mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/base/single-column-with-buttons.html.twig
create mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/contact-info.html.twig
rename docroot/modules/custom/va_gov_form_builder/templates/page-content/{page-content--va-gov-form-builder--home.html.twig => home.html.twig} (99%)
create mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/identification-info.html.twig
rename docroot/modules/custom/va_gov_form_builder/templates/page-content/{page-content--va-gov-form-builder--layout.html.twig => layout.html.twig} (99%)
create mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/name-and-dob.html.twig
delete mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--address-info.html.twig
delete mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--contact-info.html.twig
delete mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--identification-info.html.twig
delete mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--name-and-dob.html.twig
delete mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--review-and-sign.html.twig
create mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/review-and-sign.html.twig
create mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/view-form--available.html.twig
create mode 100644 docroot/modules/custom/va_gov_form_builder/templates/page-content/view-form--unavailable.html.twig
create mode 100644 tests/phpunit/va_gov_form_builder/functional/content-pages/ViewFormTest.php
diff --git a/docroot/modules/custom/va_gov_form_builder/css/form_builder.css b/docroot/modules/custom/va_gov_form_builder/css/form-builder.css
similarity index 100%
rename from docroot/modules/custom/va_gov_form_builder/css/form_builder.css
rename to docroot/modules/custom/va_gov_form_builder/css/form-builder.css
diff --git a/docroot/modules/custom/va_gov_form_builder/css/form_info.css b/docroot/modules/custom/va_gov_form_builder/css/form-info.css
similarity index 100%
rename from docroot/modules/custom/va_gov_form_builder/css/form_info.css
rename to docroot/modules/custom/va_gov_form_builder/css/form-info.css
diff --git a/docroot/modules/custom/va_gov_form_builder/css/page_content__layout__non_editable_pattern.css b/docroot/modules/custom/va_gov_form_builder/css/non-editable-pattern.css
similarity index 100%
rename from docroot/modules/custom/va_gov_form_builder/css/page_content__layout__non_editable_pattern.css
rename to docroot/modules/custom/va_gov_form_builder/css/non-editable-pattern.css
diff --git a/docroot/modules/custom/va_gov_form_builder/css/single-column-with-buttons.css b/docroot/modules/custom/va_gov_form_builder/css/single-column-with-buttons.css
new file mode 100644
index 0000000000..a50da10754
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/css/single-column-with-buttons.css
@@ -0,0 +1,3 @@
+.form-builder-single-column-with-buttons__main-content > p {
+ margin-bottom: var(--units-3);
+}
diff --git a/docroot/modules/custom/va_gov_form_builder/images/phone-and-email.png b/docroot/modules/custom/va_gov_form_builder/images/contact-info.png
similarity index 100%
rename from docroot/modules/custom/va_gov_form_builder/images/phone-and-email.png
rename to docroot/modules/custom/va_gov_form_builder/images/contact-info.png
diff --git a/docroot/modules/custom/va_gov_form_builder/src/Controller/VaGovFormBuilderController.php b/docroot/modules/custom/va_gov_form_builder/src/Controller/VaGovFormBuilderController.php
index d8ca894e52..dde1f845e3 100644
--- a/docroot/modules/custom/va_gov_form_builder/src/Controller/VaGovFormBuilderController.php
+++ b/docroot/modules/custom/va_gov_form_builder/src/Controller/VaGovFormBuilderController.php
@@ -26,6 +26,11 @@
*/
class VaGovFormBuilderController extends ControllerBase {
+ /**
+ * The Form Builder's image directory.
+ */
+ const IMAGE_DIR = '/modules/custom/va_gov_form_builder/images/';
+
/**
* The prefix for the page-content theme definitions.
*/
@@ -34,7 +39,7 @@ class VaGovFormBuilderController extends ControllerBase {
/**
* The prefix for the page-specific style libraries.
*/
- const LIBRARY_PREFIX = 'va_gov_form_builder/va_gov_form_builder_styles__';
+ const LIBRARY_PREFIX = 'va_gov_form_builder/';
/**
* The entity type manager service.
@@ -210,7 +215,7 @@ protected function getPage($pageContent, $subtitle, $breadcrumbs = [], $librarie
// Add styles.
'#attached' => [
'library' => [
- 'va_gov_form_builder/va_gov_form_builder_styles',
+ self::LIBRARY_PREFIX . 'form_builder',
],
],
];
@@ -365,7 +370,7 @@ public function layout($nid) {
'url' => '',
],
'#view_form' => [
- 'url' => '',
+ 'url' => $this->getPageUrl('view_form'),
],
];
$subtitle = $this->digitalForm->getTitle();
@@ -391,20 +396,28 @@ public function nameAndDob($nid) {
'#theme' => self::PAGE_CONTENT_THEME_PREFIX . 'name_and_dob',
'#preview' => [
'alt_text' => 'Name-and-date-of-birth preview',
- 'url' => '/modules/custom/va_gov_form_builder/images/name-and-dob.png',
+ 'url' => self::IMAGE_DIR . 'name-and-dob.png',
],
- '#primary_button' => [
- 'label' => 'Save and continue',
- 'url' => $this->getPageUrl('layout'),
- ],
- '#secondary_button' => [
- 'label' => 'Next page',
- 'url' => $this->getPageUrl('identification_info'),
+ '#buttons' => [
+ 'primary' => [
+ 'label' => 'Save and continue',
+ 'url' => $this->getPageUrl('layout'),
+ ],
+ 'secondary' => [
+ [
+ 'label' => 'Next page',
+ 'url' => $this->getPageUrl('identification_info'),
+ ],
+ ],
],
];
+
$subtitle = $this->digitalForm->getTitle();
$breadcrumbs = $this->generateBreadcrumbs('layout', 'Personal information');
- $libraries = ['page_content__layout__non_editable_pattern'];
+ $libraries = [
+ 'single_column_with_buttons',
+ 'non_editable_pattern',
+ ];
return $this->getPage($pageContent, $subtitle, $breadcrumbs, $libraries);
}
@@ -425,20 +438,28 @@ public function identificationInfo($nid) {
'#theme' => self::PAGE_CONTENT_THEME_PREFIX . 'identification_info',
'#preview' => [
'alt_text' => 'Identification-information preview',
- 'url' => '/modules/custom/va_gov_form_builder/images/identification-info.png',
+ 'url' => self::IMAGE_DIR . 'identification-info.png',
],
- '#primary_button' => [
- 'label' => 'Save and continue',
- 'url' => $this->getPageUrl('layout'),
- ],
- '#secondary_button' => [
- 'label' => 'Previous page',
- 'url' => $this->getPageUrl('name_and_dob'),
+ '#buttons' => [
+ 'primary' => [
+ 'label' => 'Save and continue',
+ 'url' => $this->getPageUrl('layout'),
+ ],
+ 'secondary' => [
+ [
+ 'label' => 'Previous page',
+ 'url' => $this->getPageUrl('name_and_dob'),
+ ],
+ ],
],
];
+
$subtitle = $this->digitalForm->getTitle();
$breadcrumbs = $this->generateBreadcrumbs('layout', 'Personal information');
- $libraries = ['page_content__layout__non_editable_pattern'];
+ $libraries = [
+ 'single_column_with_buttons',
+ 'non_editable_pattern',
+ ];
return $this->getPage($pageContent, $subtitle, $breadcrumbs, $libraries);
}
@@ -459,16 +480,21 @@ public function addressInfo($nid) {
'#theme' => self::PAGE_CONTENT_THEME_PREFIX . 'address_info',
'#preview' => [
'alt_text' => 'Address-information preview',
- 'url' => '/modules/custom/va_gov_form_builder/images/address-info.png',
+ 'url' => self::IMAGE_DIR . 'address-info.png',
],
- '#primary_button' => [
- 'label' => 'Save and continue',
- 'url' => $this->getPageUrl('layout'),
+ '#buttons' => [
+ 'primary' => [
+ 'label' => 'Save and continue',
+ 'url' => $this->getPageUrl('layout'),
+ ],
],
];
$subtitle = $this->digitalForm->getTitle();
$breadcrumbs = $this->generateBreadcrumbs('layout', 'Address information');
- $libraries = ['page_content__layout__non_editable_pattern'];
+ $libraries = [
+ 'single_column_with_buttons',
+ 'non_editable_pattern',
+ ];
return $this->getPage($pageContent, $subtitle, $breadcrumbs, $libraries);
}
@@ -488,17 +514,22 @@ public function contactInfo($nid) {
$pageContent = [
'#theme' => self::PAGE_CONTENT_THEME_PREFIX . 'contact_info',
'#preview' => [
- 'alt_text' => 'Phone-and-email-address preview',
- 'url' => '/modules/custom/va_gov_form_builder/images/phone-and-email.png',
+ 'alt_text' => 'Contact-information preview',
+ 'url' => self::IMAGE_DIR . 'contact-info.png',
],
- '#primary_button' => [
- 'label' => 'Save and continue',
- 'url' => $this->getPageUrl('layout'),
+ '#buttons' => [
+ 'primary' => [
+ 'label' => 'Save and continue',
+ 'url' => $this->getPageUrl('layout'),
+ ],
],
];
$subtitle = $this->digitalForm->getTitle();
$breadcrumbs = $this->generateBreadcrumbs('layout', 'Contact information');
- $libraries = ['page_content__layout__non_editable_pattern'];
+ $libraries = [
+ 'single_column_with_buttons',
+ 'non_editable_pattern',
+ ];
return $this->getPage($pageContent, $subtitle, $breadcrumbs, $libraries);
}
@@ -521,14 +552,74 @@ public function reviewAndSign($nid) {
'alt_text' => 'Statement-of-truth preview',
'url' => '/modules/custom/va_gov_form_builder/images/statement-of-truth.png',
],
- '#primary_button' => [
- 'label' => 'Save and continue',
- 'url' => $this->getPageUrl('layout'),
+ '#buttons' => [
+ 'primary' => [
+ 'label' => 'Save and continue',
+ 'url' => $this->getPageUrl('layout'),
+ ],
],
];
$subtitle = $this->digitalForm->getTitle();
$breadcrumbs = $this->generateBreadcrumbs('layout', 'Review page');
- $libraries = ['page_content__layout__non_editable_pattern'];
+ $libraries = [
+ 'single_column_with_buttons',
+ 'non_editable_pattern',
+ ];
+
+ return $this->getPage($pageContent, $subtitle, $breadcrumbs, $libraries);
+ }
+
+ /**
+ * View-form page.
+ *
+ * @param string $nid
+ * The node id of the Digital Form.
+ */
+ public function viewForm($nid) {
+ $nodeFound = $this->loadDigitalForm($nid);
+ if (!$nodeFound) {
+ throw new NotFoundHttpException();
+ }
+
+ // Note: We do not yet have the a field on the Digital Form
+ // node to store the form's staging url. Once we have that,
+ // this will be updated with logic to set `$isFormViewable`
+ // based on whether that field is populated. For now, the check
+ // for the form's title provides a mechanism to test both
+ // the available and unavailable contexts by changing between
+ // forms in Form Builder.
+ $isFormViewable = $this->digitalForm->getTitle() === 'Form 1';
+ $viewFormStatus = $isFormViewable ? 'available' : 'unavailable';
+
+ $buttons = $isFormViewable ? [
+ 'primary' => [
+ 'label' => 'Launch view',
+ // Temporary. Send somewhere other than layout page for now.
+ 'url' => $this->getPageUrl('home'),
+ ],
+ 'secondary' => [
+ [
+ 'label' => 'Return',
+ 'url' => $this->getPageUrl('layout'),
+ ],
+ ],
+ ] : [
+ 'primary' => [
+ 'label' => 'Return',
+ 'url' => $this->getPageUrl('layout'),
+ ],
+ ];
+
+ $breadcrumbLabel = $isFormViewable ? 'View form' : 'Form not ready';
+
+ $pageContent = [
+ '#theme' => self::PAGE_CONTENT_THEME_PREFIX . 'view_form__' . $viewFormStatus,
+ '#buttons' => $buttons,
+ ];
+
+ $subtitle = $this->digitalForm->getTitle();
+ $breadcrumbs = $this->generateBreadcrumbs('layout', $breadcrumbLabel);
+ $libraries = ['single_column_with_buttons'];
return $this->getPage($pageContent, $subtitle, $breadcrumbs, $libraries);
}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/address-info.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/address-info.html.twig
new file mode 100644
index 0000000000..22ef377305
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/address-info.html.twig
@@ -0,0 +1,5 @@
+{% extends '@va_gov_form_builder/page-content/base/non-editable-pattern.html.twig' %}
+
+{% set page_id = 'address-info' %}
+{% set page_heading = 'Collecting address information' %}
+{% set step_label = 'Address information' %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/layout/non-editable-pattern.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/base/non-editable-pattern.html.twig
similarity index 50%
rename from docroot/modules/custom/va_gov_form_builder/templates/page-content/layout/non-editable-pattern.html.twig
rename to docroot/modules/custom/va_gov_form_builder/templates/page-content/base/non-editable-pattern.html.twig
index bed638125c..f58601bde5 100644
--- a/docroot/modules/custom/va_gov_form_builder/templates/page-content/layout/non-editable-pattern.html.twig
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/base/non-editable-pattern.html.twig
@@ -1,6 +1,6 @@
-
-
{{ page_heading }}
+{% extends '@va_gov_form_builder/page-content/base/single-column-with-buttons.html.twig' %}
+{% block main_content %}
{% include '@va_gov_form_builder/components/banner--non-editable-pattern.html.twig' with {
heading_level: 3,
} %}
@@ -18,7 +18,7 @@
{% if block('step_description') is not empty %}
- {% block step_description%}{% endblock %}
+ {% block step_description %}{% endblock %}
{% endif %}
@@ -27,29 +27,5 @@
No edits are possible for this item

-
-
-
-
+{% endblock %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/base/single-column-with-buttons.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/base/single-column-with-buttons.html.twig
new file mode 100644
index 0000000000..8b91f74d5f
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/base/single-column-with-buttons.html.twig
@@ -0,0 +1,34 @@
+
+
{{ page_heading }}
+
+ {% if block('main_content') is not empty %}
+
+ {% block main_content %}{% endblock %}
+
+ {% endif %}
+
+
+
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/contact-info.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/contact-info.html.twig
new file mode 100644
index 0000000000..9c10bcb770
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/contact-info.html.twig
@@ -0,0 +1,5 @@
+{% extends '@va_gov_form_builder/page-content/base/non-editable-pattern.html.twig' %}
+
+{% set page_id = 'contact-info' %}
+{% set page_heading = 'Collecting contact information' %}
+{% set step_label = 'Contact information' %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--home.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/home.html.twig
similarity index 99%
rename from docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--home.html.twig
rename to docroot/modules/custom/va_gov_form_builder/templates/page-content/home.html.twig
index 7c64b22453..e84391bc05 100644
--- a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--home.html.twig
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/home.html.twig
@@ -32,6 +32,4 @@
{% endfor %}
-
-
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/identification-info.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/identification-info.html.twig
new file mode 100644
index 0000000000..f3d21a5f4f
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/identification-info.html.twig
@@ -0,0 +1,16 @@
+{% extends '@va_gov_form_builder/page-content/base/non-editable-pattern.html.twig' %}
+
+{% set page_id = 'identification-info' %}
+{% set page_heading = 'Collecting identifying information' %}
+{% set step_label = 'Your personal information' %}
+
+{% block step_description %}
+
+ Note: Below is the default pattern for asking a submitter for this information.
+ Some forms may ask for other types of information. The guidance for this item can be found
+ here:
+
+ https://design.va.gov/patterns/ask-users-for/social-security-number#examples
+
+
+{% endblock %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--layout.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/layout.html.twig
similarity index 99%
rename from docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--layout.html.twig
rename to docroot/modules/custom/va_gov_form_builder/templates/page-content/layout.html.twig
index 4a869c5ba6..b7b5361623 100644
--- a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--layout.html.twig
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/layout.html.twig
@@ -78,7 +78,7 @@
Once all of the steps are complete, this form can be viewed by selecting View form.
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/name-and-dob.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/name-and-dob.html.twig
new file mode 100644
index 0000000000..07cde1b582
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/name-and-dob.html.twig
@@ -0,0 +1,5 @@
+{% extends '@va_gov_form_builder/page-content/base/non-editable-pattern.html.twig' %}
+
+{% set page_id = 'name-and-dob' %}
+{% set page_heading = 'Collecting Name and Date of birth' %}
+{% set step_label = 'Your personal information' %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--address-info.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--address-info.html.twig
deleted file mode 100644
index 62060480c6..0000000000
--- a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--address-info.html.twig
+++ /dev/null
@@ -1,7 +0,0 @@
-{% include '@va_gov_form_builder/page-content/layout/non-editable-pattern.html.twig' with {
- page_id: 'address-info',
- page_heading: 'Collecting address information',
- step_label: 'Address information',
- preview: preview,
- primary_button: primary_button,
-} only %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--contact-info.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--contact-info.html.twig
deleted file mode 100644
index ca89a98e94..0000000000
--- a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--contact-info.html.twig
+++ /dev/null
@@ -1,7 +0,0 @@
-{% include '@va_gov_form_builder/page-content/layout/non-editable-pattern.html.twig' with {
- page_id: 'contact-info',
- page_heading: 'Collecting contact information',
- step_label: 'Contact information',
- preview: preview,
- primary_button: primary_button,
-} only %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--identification-info.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--identification-info.html.twig
deleted file mode 100644
index 71d63f7137..0000000000
--- a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--identification-info.html.twig
+++ /dev/null
@@ -1,8 +0,0 @@
-{% include '@va_gov_form_builder/page-content/layout/non-editable-pattern.html.twig' with {
- page_id: 'identification-info',
- page_heading: 'Collecting identifying information',
- step_label: 'Your personal information',
- preview: preview,
- primary_button: primary_button,
- secondary_button: secondary_button,
-} only %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--name-and-dob.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--name-and-dob.html.twig
deleted file mode 100644
index ba19350196..0000000000
--- a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--name-and-dob.html.twig
+++ /dev/null
@@ -1,8 +0,0 @@
-{% include '@va_gov_form_builder/page-content/layout/non-editable-pattern.html.twig' with {
- page_id: 'name-and-dob',
- page_heading: 'Collecting Name and Date of birth',
- step_label: 'Your personal information',
- preview: preview,
- primary_button: primary_button,
- secondary_button: secondary_button,
-} only %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--review-and-sign.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--review-and-sign.html.twig
deleted file mode 100644
index ddeb515803..0000000000
--- a/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--review-and-sign.html.twig
+++ /dev/null
@@ -1,21 +0,0 @@
-{% embed '@va_gov_form_builder/page-content/layout/non-editable-pattern.html.twig' with {
- page_id: 'review-and-sign',
- page_heading: 'Reviewing the submission',
- step_label: 'Review and sign',
- preview: preview,
- primary_button: primary_button,
-} only %}
- {% block step_description %}
-
- This step of the form allows the submitter to review their inputs and then affirm that what
- was provided is accurate. Not shown in this tool are all of the steps that are part of this form.
- Steps are listed on the layout page.
-
-
-
- Note: For any added step that can map signatures to an
- alternate certification or attestation, the universal statement of truth on the review
- step covers those situations as well. There is no need to add in additional text.
-
- {% endblock %}
-{% endembed %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/review-and-sign.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/review-and-sign.html.twig
new file mode 100644
index 0000000000..0ae26847b8
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/review-and-sign.html.twig
@@ -0,0 +1,18 @@
+{% extends '@va_gov_form_builder/page-content/base/non-editable-pattern.html.twig' %}
+
+{% set page_id = 'review-and-sign' %}
+{% set page_heading = 'Reviewing the submission' %}
+{% set step_label = 'Review and sign' %}
+
+{% block step_description %}
+
+ This step of the form allows the submitter to review their inputs and then affirm that what
+ was provided is accurate. Not shown in this tool are all of the steps that are part of this form.
+ Steps are listed on the layout page.
+
+
+ Note: For any added step that can map signatures to an
+ alternate certification or attestation, the universal statement of truth on the review
+ step covers those situations as well. There is no need to add in additional text.
+
+{% endblock %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/view-form--available.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/view-form--available.html.twig
new file mode 100644
index 0000000000..d00c97753d
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/view-form--available.html.twig
@@ -0,0 +1,11 @@
+{% extends '@va_gov_form_builder/page-content/base/single-column-with-buttons.html.twig' %}
+
+{% set page_id = 'view-form' %}
+{% set page_heading = 'Reviewing the form' %}
+
+{% block main_content %}
+ By selecting Launch view, it is possible to view the content choices and steps selected as part of this form creation.
+ Please note that not all of your most recent updates may have been picked up by the build process yet. Note that content builds typically happen daily.
+ If you do not see your most recent content choices in the preview, you may need to refresh or check back later.
+ To experience this form as a signed in user you may need be signed into a test account.
+{% endblock %}
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page-content/view-form--unavailable.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page-content/view-form--unavailable.html.twig
new file mode 100644
index 0000000000..35f28b8940
--- /dev/null
+++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/view-form--unavailable.html.twig
@@ -0,0 +1,10 @@
+{% extends '@va_gov_form_builder/page-content/base/single-column-with-buttons.html.twig' %}
+
+{% set page_id = 'view-form' %}
+{% set page_heading = 'Reviewing the form' %}
+
+{% block main_content %}
+ It is not possible to view the content choices and steps selected as part of this form creation.
+ An application must be established creating a URL on the VA Staging site to host the choice that have been selected in Form Builder in order to view this form.
+ Please contact your engineering resource for further details.
+{% endblock %}
diff --git a/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.libraries.yml b/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.libraries.yml
index 01733857d2..a003a40c4c 100644
--- a/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.libraries.yml
+++ b/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.libraries.yml
@@ -1,27 +1,32 @@
-va_gov_form_builder_styles:
+form_builder:
version: 1.x
css:
theme:
- css/form_builder.css: {}
+ css/form-builder.css: {}
https://unpkg.com/@department-of-veterans-affairs/css-library@0.16.0/dist/tokens/css/variables.css:
{}
-va_gov_form_builder_styles__home:
+home:
version: 1.x
css:
theme:
css/home.css: {}
-va_gov_form_builder_styles__form_info:
+form_info:
version: 1.x
css:
theme:
- css/form_info.css: {}
-va_gov_form_builder_styles__layout:
+ css/form-info.css: {}
+layout:
version: 1.x
css:
theme:
css/layout.css: {}
-va_gov_form_builder_styles__page_content__layout__non_editable_pattern:
+single_column_with_buttons:
version: 1.x
css:
theme:
- css/page_content__layout__non_editable_pattern.css: {}
+ css/single-column-with-buttons.css: {}
+non_editable_pattern:
+ version: 1.x
+ css:
+ theme:
+ css/non-editable-pattern.css: {}
diff --git a/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.module b/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.module
index 3d718f7497..cf72f75185 100644
--- a/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.module
+++ b/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.module
@@ -36,6 +36,7 @@ function va_gov_form_builder_theme($_existing, $_type, $_theme, $path) {
// 1. Home page.
$theme[$page_content_theme_prefix . 'home'] = [
'path' => $page_content_theme_path,
+ 'template' => 'home',
'variables' => [
'recent_forms' => [],
'build_form_url' => '',
@@ -44,6 +45,7 @@ function va_gov_form_builder_theme($_existing, $_type, $_theme, $path) {
// 2. Layout page.
$theme[$page_content_theme_prefix . 'layout'] = [
'path' => $page_content_theme_path,
+ 'template' => 'layout',
'variables' => [
'form_info' => [
'status' => '',
@@ -85,32 +87,60 @@ function va_gov_form_builder_theme($_existing, $_type, $_theme, $path) {
],
];
// 3. Non-editable-pattern steps.
- $button = [
- 'label' => '',
- 'url' => '',
- ];
- $nonEditablePatternTheme = [
- 'path' => $page_content_theme_path,
- 'variables' => [
- 'preview' => [
- 'alt_text' => '',
- 'url' => '',
- ],
- 'primary_button' => $button,
+ $nonEditablePatternVariables = [
+ 'preview' => [
+ 'alt_text' => '',
+ 'url' => '',
],
+ 'buttons' => [],
];
- $nonEditablePatternWithSecondaryButtonTheme = $nonEditablePatternTheme;
- $nonEditablePatternWithSecondaryButtonTheme['variables']['secondary_button'] = $button;
+
// 3a. Name and Date of birth page.
- $theme[$page_content_theme_prefix . 'name_and_dob'] = $nonEditablePatternWithSecondaryButtonTheme;
+ $theme[$page_content_theme_prefix . 'name_and_dob'] = [
+ 'path' => $page_content_theme_path,
+ 'template' => 'name-and-dob',
+ 'variables' => $nonEditablePatternVariables,
+ ];
// 3b. Identification information page.
- $theme[$page_content_theme_prefix . 'identification_info'] = $nonEditablePatternWithSecondaryButtonTheme;
+ $theme[$page_content_theme_prefix . 'identification_info'] = [
+ 'path' => $page_content_theme_path,
+ 'template' => 'identification-info',
+ 'variables' => $nonEditablePatternVariables,
+ ];
// 3c. Address information page.
- $theme[$page_content_theme_prefix . 'address_info'] = $nonEditablePatternTheme;
+ $theme[$page_content_theme_prefix . 'address_info'] = [
+ 'path' => $page_content_theme_path,
+ 'template' => 'address-info',
+ 'variables' => $nonEditablePatternVariables,
+ ];
// 3d. Contact information page.
- $theme[$page_content_theme_prefix . 'contact_info'] = $nonEditablePatternTheme;
+ $theme[$page_content_theme_prefix . 'contact_info'] = [
+ 'path' => $page_content_theme_path,
+ 'template' => 'contact-info',
+ 'variables' => $nonEditablePatternVariables,
+ ];
// 3e. Review and Sign page.
- $theme[$page_content_theme_prefix . 'review_and_sign'] = $nonEditablePatternTheme;
+ $theme[$page_content_theme_prefix . 'review_and_sign'] = [
+ 'path' => $page_content_theme_path,
+ 'template' => 'review-and-sign',
+ 'variables' => $nonEditablePatternVariables,
+ ];
+ // 4. View-form page
+ $viewFormPageVariables = [
+ 'buttons' => [],
+ ];
+ // 4a. View-form page when viewing form is available.
+ $theme[$page_content_theme_prefix . 'view_form__available'] = [
+ 'path' => $page_content_theme_path,
+ 'template' => 'view-form--available',
+ 'variables' => $viewFormPageVariables,
+ ];
+ // 4b. View-form page when viewing form is unavailable.
+ $theme[$page_content_theme_prefix . 'view_form__unavailable'] = [
+ 'path' => $page_content_theme_path,
+ 'template' => 'view-form--unavailable',
+ 'variables' => $viewFormPageVariables,
+ ];
// Add form themes.
$forms = ['form_info'];
diff --git a/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.routing.yml b/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.routing.yml
index 86b8a7980f..9d0e3e22f0 100644
--- a/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.routing.yml
+++ b/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.routing.yml
@@ -40,3 +40,7 @@ va_gov_form_builder.review_and_sign:
path: "/form-builder/{nid}/review-and-sign"
defaults:
_controller: '\Drupal\va_gov_form_builder\Controller\VaGovFormBuilderController::reviewAndSign'
+va_gov_form_builder.view_form:
+ path: "/form-builder/{nid}/view-form"
+ defaults:
+ _controller: '\Drupal\va_gov_form_builder\Controller\VaGovFormBuilderController::viewForm'
diff --git a/tests/phpunit/va_gov_form_builder/functional/Controller/VaGovFormBuilderControllerTest.php b/tests/phpunit/va_gov_form_builder/functional/Controller/VaGovFormBuilderControllerTest.php
index 30ddce6659..0c82e45fb3 100644
--- a/tests/phpunit/va_gov_form_builder/functional/Controller/VaGovFormBuilderControllerTest.php
+++ b/tests/phpunit/va_gov_form_builder/functional/Controller/VaGovFormBuilderControllerTest.php
@@ -58,9 +58,9 @@ public function testCssIncluded() {
$page = $this->controller->home();
$this->assertContains(
- 'va_gov_form_builder/va_gov_form_builder_styles',
+ 'va_gov_form_builder/form_builder',
$page['#attached']['library'],
- "The library 'va_gov_form_builder/va_gov_form_builder_styles' is successfully attached."
+ "The library 'va_gov_form_builder/form_builder' is successfully attached."
);
}
@@ -86,7 +86,7 @@ public function testHome() {
// Ensure css is added.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__home', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/home', $page['#attached']['library']);
}
/**
@@ -104,7 +104,7 @@ public function testFormInfoCreate() {
// Ensure css is added.
// This should be present on both create and edit mode.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__form_info', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/form_info', $page['#attached']['library']);
}
@@ -135,7 +135,7 @@ public function testFormInfoEdit() {
// Ensure css is added.
// This should be present on both create and edit mode.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__form_info', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/form_info', $page['#attached']['library']);
}
/**
@@ -199,7 +199,7 @@ public function testLayout() {
// Ensure css is added.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__layout', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/layout', $page['#attached']['library']);
}
/**
@@ -225,22 +225,26 @@ public function testNameAndDob() {
$this->assertEquals('Name-and-date-of-birth preview', $page['content']['#preview']['alt_text']);
$this->assertArrayHasKey('url', $page['content']['#preview']);
$this->assertStringContainsString('name-and-dob.png', $page['content']['#preview']['url']);
+ // Buttons.
+ $this->assertArrayHasKey('#buttons', $page['content']);
// Primary button.
- $this->assertArrayHasKey('#primary_button', $page['content']);
- $this->assertArrayHasKey('label', $page['content']['#primary_button']);
- $this->assertEquals('Save and continue', $page['content']['#primary_button']['label']);
- $this->assertArrayHasKey('url', $page['content']['#primary_button']);
- $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#primary_button']['url']);
- // Secondary button.
- $this->assertArrayHasKey('#secondary_button', $page['content']);
- $this->assertArrayHasKey('label', $page['content']['#secondary_button']);
- $this->assertEquals('Next page', $page['content']['#secondary_button']['label']);
- $this->assertArrayHasKey('url', $page['content']['#secondary_button']);
- $this->assertStringContainsString("/form-builder/{$node->id()}/identification-info", $page['content']['#secondary_button']['url']);
+ $this->assertArrayHasKey('primary', $page['content']['#buttons']);
+ $this->assertArrayHasKey('label', $page['content']['#buttons']['primary']);
+ $this->assertEquals('Save and continue', $page['content']['#buttons']['primary']['label']);
+ $this->assertArrayHasKey('url', $page['content']['#buttons']['primary']);
+ $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#buttons']['primary']['url']);
+ // Secondary buttons.
+ $this->assertArrayHasKey('secondary', $page['content']['#buttons']);
+ $this->assertCount(1, $page['content']['#buttons']['secondary']);
+ $this->assertArrayHasKey('label', $page['content']['#buttons']['secondary'][0]);
+ $this->assertEquals('Next page', $page['content']['#buttons']['secondary'][0]['label']);
+ $this->assertArrayHasKey('url', $page['content']['#buttons']['secondary'][0]);
+ $this->assertStringContainsString("/form-builder/{$node->id()}/identification-info", $page['content']['#buttons']['secondary'][0]['url']);
// Ensure css is added as expected.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__page_content__layout__non_editable_pattern', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/single_column_with_buttons', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/non_editable_pattern', $page['#attached']['library']);
}
/**
@@ -268,22 +272,26 @@ public function testIdentificationInfo() {
$this->assertEquals('Identification-information preview', $page['content']['#preview']['alt_text']);
$this->assertArrayHasKey('url', $page['content']['#preview']);
$this->assertStringContainsString('identification-info.png', $page['content']['#preview']['url']);
+ // Buttons.
+ $this->assertArrayHasKey('#buttons', $page['content']);
// Primary button.
- $this->assertArrayHasKey('#primary_button', $page['content']);
- $this->assertArrayHasKey('label', $page['content']['#primary_button']);
- $this->assertEquals('Save and continue', $page['content']['#primary_button']['label']);
- $this->assertArrayHasKey('url', $page['content']['#primary_button']);
- $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#primary_button']['url']);
- // Secondary button.
- $this->assertArrayHasKey('#secondary_button', $page['content']);
- $this->assertArrayHasKey('label', $page['content']['#secondary_button']);
- $this->assertEquals('Previous page', $page['content']['#secondary_button']['label']);
- $this->assertArrayHasKey('url', $page['content']['#secondary_button']);
- $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#secondary_button']['url']);
+ $this->assertArrayHasKey('primary', $page['content']['#buttons']);
+ $this->assertArrayHasKey('label', $page['content']['#buttons']['primary']);
+ $this->assertEquals('Save and continue', $page['content']['#buttons']['primary']['label']);
+ $this->assertArrayHasKey('url', $page['content']['#buttons']['primary']);
+ $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#buttons']['primary']['url']);
+ // Secondary buttons.
+ $this->assertArrayHasKey('secondary', $page['content']['#buttons']);
+ $this->assertCount(1, $page['content']['#buttons']['secondary']);
+ $this->assertArrayHasKey('label', $page['content']['#buttons']['secondary'][0]);
+ $this->assertEquals('Previous page', $page['content']['#buttons']['secondary'][0]['label']);
+ $this->assertArrayHasKey('url', $page['content']['#buttons']['secondary'][0]);
+ $this->assertStringContainsString("/form-builder/{$node->id()}/name-and-dob", $page['content']['#buttons']['secondary'][0]['url']);
// Ensure css is added as expected.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__page_content__layout__non_editable_pattern', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/single_column_with_buttons', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/non_editable_pattern', $page['#attached']['library']);
}
/**
@@ -311,16 +319,19 @@ public function testAddressInfo() {
$this->assertEquals('Address-information preview', $page['content']['#preview']['alt_text']);
$this->assertArrayHasKey('url', $page['content']['#preview']);
$this->assertStringContainsString('address-info.png', $page['content']['#preview']['url']);
+ // Buttons.
+ $this->assertArrayHasKey('#buttons', $page['content']);
// Primary button.
- $this->assertArrayHasKey('#primary_button', $page['content']);
- $this->assertArrayHasKey('label', $page['content']['#primary_button']);
- $this->assertEquals('Save and continue', $page['content']['#primary_button']['label']);
- $this->assertArrayHasKey('url', $page['content']['#primary_button']);
- $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#primary_button']['url']);
+ $this->assertArrayHasKey('primary', $page['content']['#buttons']);
+ $this->assertArrayHasKey('label', $page['content']['#buttons']['primary']);
+ $this->assertEquals('Save and continue', $page['content']['#buttons']['primary']['label']);
+ $this->assertArrayHasKey('url', $page['content']['#buttons']['primary']);
+ $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#buttons']['primary']['url']);
// Ensure css is added as expected.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__page_content__layout__non_editable_pattern', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/single_column_with_buttons', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/non_editable_pattern', $page['#attached']['library']);
}
/**
@@ -345,19 +356,21 @@ public function testContactInfo() {
// Preview image.
$this->assertArrayHasKey('#preview', $page['content']);
$this->assertArrayHasKey('alt_text', $page['content']['#preview']);
- $this->assertEquals('Phone-and-email-address preview', $page['content']['#preview']['alt_text']);
+ $this->assertEquals('Contact-information preview', $page['content']['#preview']['alt_text']);
$this->assertArrayHasKey('url', $page['content']['#preview']);
- $this->assertStringContainsString('phone-and-email.png', $page['content']['#preview']['url']);
+ $this->assertStringContainsString('contact-info.png', $page['content']['#preview']['url']);
+ // Buttons.
+ $this->assertArrayHasKey('#buttons', $page['content']);
// Primary button.
- $this->assertArrayHasKey('#primary_button', $page['content']);
- $this->assertArrayHasKey('label', $page['content']['#primary_button']);
- $this->assertEquals('Save and continue', $page['content']['#primary_button']['label']);
- $this->assertArrayHasKey('url', $page['content']['#primary_button']);
- $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#primary_button']['url']);
-
+ $this->assertArrayHasKey('primary', $page['content']['#buttons']);
+ $this->assertArrayHasKey('label', $page['content']['#buttons']['primary']);
+ $this->assertEquals('Save and continue', $page['content']['#buttons']['primary']['label']);
+ $this->assertArrayHasKey('url', $page['content']['#buttons']['primary']);
+ $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#buttons']['primary']['url']);
// Ensure css is added as expected.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__page_content__layout__non_editable_pattern', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/single_column_with_buttons', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/non_editable_pattern', $page['#attached']['library']);
}
/**
@@ -384,16 +397,48 @@ public function testReviewAndSign() {
$this->assertEquals('Statement-of-truth preview', $page['content']['#preview']['alt_text']);
$this->assertArrayHasKey('url', $page['content']['#preview']);
$this->assertStringContainsString('statement-of-truth.png', $page['content']['#preview']['url']);
+ // Buttons.
+ $this->assertArrayHasKey('#buttons', $page['content']);
+ // Primary button.
+ $this->assertArrayHasKey('primary', $page['content']['#buttons']);
+ $this->assertArrayHasKey('label', $page['content']['#buttons']['primary']);
+ $this->assertEquals('Save and continue', $page['content']['#buttons']['primary']['label']);
+ $this->assertArrayHasKey('url', $page['content']['#buttons']['primary']);
+ $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#buttons']['primary']['url']);
+
+ // Ensure css is added as expected.
+ $this->assertArrayHasKey('#attached', $page);
+ $this->assertContains('va_gov_form_builder/single_column_with_buttons', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/non_editable_pattern', $page['#attached']['library']);
+ }
+
+ /**
+ * Tests the viewForm method returns a View-form page.
+ */
+ public function testViewForm() {
+ // Create a node.
+ $node = $this->createNode([
+ 'type' => 'digital_form',
+ 'field_chapters' => [],
+ ]);
+
+ $page = $this->controller->viewForm($node->id());
+
+ $this->assertArrayHasKey('content', $page);
+ // Ensure theme is set as expected.
+ $this->assertArrayHasKey('#theme', $page['content']);
+ $this->assertStringContainsSTring('page_content__va_gov_form_builder__view_form', $page['content']['#theme']);
+
+ // Ensure variables are set as expected.
+ // Buttons.
+ $this->assertArrayHasKey('#buttons', $page['content']);
// Primary button.
- $this->assertArrayHasKey('#primary_button', $page['content']);
- $this->assertArrayHasKey('label', $page['content']['#primary_button']);
- $this->assertEquals('Save and continue', $page['content']['#primary_button']['label']);
- $this->assertArrayHasKey('url', $page['content']['#primary_button']);
- $this->assertStringContainsString("/form-builder/{$node->id()}", $page['content']['#primary_button']['url']);
+ // @todo Update buttons test when staging-url field is added.
+ $this->assertArrayHasKey('primary', $page['content']['#buttons']);
// Ensure css is added as expected.
$this->assertArrayHasKey('#attached', $page);
- $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__page_content__layout__non_editable_pattern', $page['#attached']['library']);
+ $this->assertContains('va_gov_form_builder/single_column_with_buttons', $page['#attached']['library']);
}
}
diff --git a/tests/phpunit/va_gov_form_builder/functional/content-pages/AddressInfoTest.php b/tests/phpunit/va_gov_form_builder/functional/content-pages/AddressInfoTest.php
index e9b87a68a1..02f0b40766 100644
--- a/tests/phpunit/va_gov_form_builder/functional/content-pages/AddressInfoTest.php
+++ b/tests/phpunit/va_gov_form_builder/functional/content-pages/AddressInfoTest.php
@@ -123,7 +123,7 @@ public function testPageBreadcrumbs() {
*/
public function testPrimaryButton() {
$this->drupalGet($this->getPageUrl());
- $this->click('a#form-builder-non-editable-pattern-primary-button');
+ $this->click('a#form-builder-primary-button');
$this->assertSession()->addressEquals("/form-builder/{$this->digitalFormNode->id()}");
}
diff --git a/tests/phpunit/va_gov_form_builder/functional/content-pages/ContactInfoTest.php b/tests/phpunit/va_gov_form_builder/functional/content-pages/ContactInfoTest.php
index 7614c200ea..78b1b55723 100644
--- a/tests/phpunit/va_gov_form_builder/functional/content-pages/ContactInfoTest.php
+++ b/tests/phpunit/va_gov_form_builder/functional/content-pages/ContactInfoTest.php
@@ -123,7 +123,7 @@ public function testPageBreadcrumbs() {
*/
public function testPrimaryButton() {
$this->drupalGet($this->getPageUrl());
- $this->click('a#form-builder-non-editable-pattern-primary-button');
+ $this->click('a#form-builder-primary-button');
$this->assertSession()->addressEquals("/form-builder/{$this->digitalFormNode->id()}");
}
diff --git a/tests/phpunit/va_gov_form_builder/functional/content-pages/IdentificationInfoTest.php b/tests/phpunit/va_gov_form_builder/functional/content-pages/IdentificationInfoTest.php
index 51f6767294..3687c6db94 100644
--- a/tests/phpunit/va_gov_form_builder/functional/content-pages/IdentificationInfoTest.php
+++ b/tests/phpunit/va_gov_form_builder/functional/content-pages/IdentificationInfoTest.php
@@ -123,7 +123,7 @@ public function testPageBreadcrumbs() {
*/
public function testPrimaryButton() {
$this->drupalGet($this->getPageUrl());
- $this->click('a#form-builder-non-editable-pattern-primary-button');
+ $this->click('a#form-builder-primary-button');
$this->assertSession()->addressEquals("/form-builder/{$this->digitalFormNode->id()}");
}
@@ -132,7 +132,7 @@ public function testPrimaryButton() {
*/
public function testSecondaryButton() {
$this->drupalGet($this->getPageUrl());
- $this->click('a#form-builder-non-editable-pattern-secondary-button');
+ $this->click('a#form-builder-secondary-button-1');
$this->assertSession()->addressEquals("/form-builder/{$this->digitalFormNode->id()}/name-and-dob");
}
diff --git a/tests/phpunit/va_gov_form_builder/functional/content-pages/NameAndDobTest.php b/tests/phpunit/va_gov_form_builder/functional/content-pages/NameAndDobTest.php
index 4274f1ea3e..fd7c807a15 100644
--- a/tests/phpunit/va_gov_form_builder/functional/content-pages/NameAndDobTest.php
+++ b/tests/phpunit/va_gov_form_builder/functional/content-pages/NameAndDobTest.php
@@ -123,7 +123,7 @@ public function testPageBreadcrumbs() {
*/
public function testPrimaryButton() {
$this->drupalGet($this->getPageUrl());
- $this->click('a#form-builder-non-editable-pattern-primary-button');
+ $this->click('a#form-builder-primary-button');
$this->assertSession()->addressEquals("/form-builder/{$this->digitalFormNode->id()}");
}
@@ -132,7 +132,7 @@ public function testPrimaryButton() {
*/
public function testSecondaryButton() {
$this->drupalGet($this->getPageUrl());
- $this->click('a#form-builder-non-editable-pattern-secondary-button');
+ $this->click('a#form-builder-secondary-button-1');
$this->assertSession()->addressEquals("/form-builder/{$this->digitalFormNode->id()}/identification-info");
}
diff --git a/tests/phpunit/va_gov_form_builder/functional/content-pages/ReviewAndSignTest.php b/tests/phpunit/va_gov_form_builder/functional/content-pages/ReviewAndSignTest.php
index 364b555f5d..f035c33d57 100644
--- a/tests/phpunit/va_gov_form_builder/functional/content-pages/ReviewAndSignTest.php
+++ b/tests/phpunit/va_gov_form_builder/functional/content-pages/ReviewAndSignTest.php
@@ -123,7 +123,7 @@ public function testPageBreadcrumbs() {
*/
public function testPrimaryButton() {
$this->drupalGet($this->getPageUrl());
- $this->click('a#form-builder-non-editable-pattern-primary-button');
+ $this->click('a#form-builder-primary-button');
$this->assertSession()->addressEquals("/form-builder/{$this->digitalFormNode->id()}");
}
diff --git a/tests/phpunit/va_gov_form_builder/functional/content-pages/ViewFormTest.php b/tests/phpunit/va_gov_form_builder/functional/content-pages/ViewFormTest.php
new file mode 100644
index 0000000000..9ba119cbd1
--- /dev/null
+++ b/tests/phpunit/va_gov_form_builder/functional/content-pages/ViewFormTest.php
@@ -0,0 +1,101 @@
+digitalFormNode->id()}/view-form";
+ }
+
+ /**
+ * Helper method to generate a test node.
+ */
+ private function generateTestNode(
+ $title = NULL,
+ $formNumber = '99-9999',
+ $contactInfoTitle = 'Contact information',
+ $listAndLoopTitle = 'Your employers',
+ ) {
+ if (!$title) {
+ $title = 'Test Digital Form ' . uniqid();
+ }
+
+ // Create a new Digital Form node.
+ $this->digitalFormNode = $this->createNode([
+ 'type' => 'digital_form',
+ 'title' => $title,
+ 'field_chapters' => [],
+ 'field_va_form_number' => $formNumber,
+ ]);
+
+ // Save node.
+ $this->digitalFormNode->save();
+ }
+
+ /**
+ * Set up the environment for each test.
+ */
+ public function setUp(): void {
+ parent::setUp();
+
+ $this->generateTestNode();
+ $this->loginFormBuilderUser();
+ }
+
+ /**
+ * Test that the page is accessible to a user with the correct privilege.
+ */
+ public function testPageLoads() {
+ // Ensure page loads.
+ $this->sharedTestPageLoads($this->getPageUrl(), 'Reviewing the form');
+ }
+
+ /**
+ * Test that the page is not accessible to a user without privilege.
+ */
+ public function testPageDoesNotLoad() {
+ $this->sharedTestPageDoesNotLoad($this->getPageUrl());
+ }
+
+ /**
+ * Test that the page has the expected subtitle.
+ *
+ * The subtitle should be the form title.
+ */
+ public function testPageSubtitle() {
+ $this->sharedTestPageHasExpectedSubtitle(
+ $this->getPageUrl(),
+ $this->digitalFormNode->getTitle(),
+ );
+ }
+
+ // Cannot test these until we have the staging-url field.
+ // @todo test breadcrumbs.
+ // @todo test buttons.
+}
diff --git a/tests/phpunit/va_gov_form_builder/unit/LibrariesTest.php b/tests/phpunit/va_gov_form_builder/unit/LibrariesTest.php
index 1374a7e2ed..2217537ecb 100644
--- a/tests/phpunit/va_gov_form_builder/unit/LibrariesTest.php
+++ b/tests/phpunit/va_gov_form_builder/unit/LibrariesTest.php
@@ -54,43 +54,46 @@ protected function setUp(): void {
* Tests that the library definition contains necessary css.
*/
public function testLibraryCss() {
- $libraryPrefix = 'va_gov_form_builder_styles';
$cssPrefix = 'css/';
- $this->assertArrayHasKey($libraryPrefix, $this->libraries);
- $this->assertArrayHasKey('css', $this->libraries[$libraryPrefix]);
- $this->assertArrayHasKey('theme', $this->libraries[$libraryPrefix]['css']);
-
- $formBuilderCssArray = array_keys($this->libraries[$libraryPrefix]['css']['theme']);
-
+ // Assert Form Builder base library is present.
+ $baseLibrary = 'form_builder';
+ $this->assertArrayHasKey($baseLibrary, $this->libraries);
+ $this->assertArrayHasKey('css', $this->libraries[$baseLibrary]);
+ $this->assertArrayHasKey('theme', $this->libraries[$baseLibrary]['css']);
// Assert Form Builder css is present.
- $this->assertContains($cssPrefix . 'form_builder.css', $formBuilderCssArray, 'Form Builder css is present.');
-
+ $formBuilderCssArray = array_keys($this->libraries[$baseLibrary]['css']['theme']);
+ $this->assertContains($cssPrefix . 'form-builder.css', $formBuilderCssArray, 'Form Builder css is present.');
// Assert external VADS tokens definition is present.
$matches = preg_grep('/unpkg.*@department-of-veterans-affairs.*css-library.*tokens\/css\/variables.css/', $formBuilderCssArray);
$this->assertNotEmpty($matches, 'VADS tokens css is present.');
- // Assert page-specific libraries are present
+ // Assert page-specific libraries are present.
// 1. Home.
- $homeLibrary = $libraryPrefix . '__home';
+ $homeLibrary = 'home';
$this->assertArrayHasKey($homeLibrary, $this->libraries);
$homeCssArray = array_keys($this->libraries[$homeLibrary]['css']['theme']);
$this->assertContains($cssPrefix . 'home.css', $homeCssArray, 'Home page css is present.');
// 2. Form Info.
- $formInfoLibrary = $libraryPrefix . '__form_info';
+ $formInfoLibrary = 'form_info';
$this->assertArrayHasKey($formInfoLibrary, $this->libraries);
$formInfoCssArray = array_keys($this->libraries[$formInfoLibrary]['css']['theme']);
- $this->assertContains($cssPrefix . 'form_info.css', $formInfoCssArray, 'Form Info page css is present.');
+ $this->assertContains($cssPrefix . 'form-info.css', $formInfoCssArray, 'Form Info page css is present.');
// 3. Layout.
- $layoutLibrary = $libraryPrefix . '__layout';
+ $layoutLibrary = 'layout';
$this->assertArrayHasKey($layoutLibrary, $this->libraries);
$layoutCssArray = array_keys($this->libraries[$layoutLibrary]['css']['theme']);
$this->assertContains($cssPrefix . 'layout.css', $layoutCssArray, 'Layout page css is present.');
- // 4. Non-editable-pattern.
- $nonEditablePatternLibrary = $libraryPrefix . '__page_content__layout__non_editable_pattern';
+ // 4. Single-column-with-buttons.
+ $singleColumnWithButtonsLibrary = 'single_column_with_buttons';
+ $this->assertArrayHasKey($singleColumnWithButtonsLibrary, $this->libraries);
+ $singleColumnWithButtonsCssArray = array_keys($this->libraries[$singleColumnWithButtonsLibrary]['css']['theme']);
+ $this->assertContains($cssPrefix . 'single-column-with-buttons.css', $singleColumnWithButtonsCssArray, 'Non-editable-pattern css is present.');
+ // 5. Non-editable-pattern.
+ $nonEditablePatternLibrary = 'non_editable_pattern';
$this->assertArrayHasKey($nonEditablePatternLibrary, $this->libraries);
$nonEditablePatternCssArray = array_keys($this->libraries[$nonEditablePatternLibrary]['css']['theme']);
- $this->assertContains($cssPrefix . 'page_content__layout__non_editable_pattern.css', $nonEditablePatternCssArray, 'Non-editable-pattern css is present.');
+ $this->assertContains($cssPrefix . 'non-editable-pattern.css', $nonEditablePatternCssArray, 'Non-editable-pattern css is present.');
}
}
diff --git a/tests/phpunit/va_gov_form_builder/unit/ModuleTest.php b/tests/phpunit/va_gov_form_builder/unit/ModuleTest.php
index f7b66025fc..30cca2de52 100644
--- a/tests/phpunit/va_gov_form_builder/unit/ModuleTest.php
+++ b/tests/phpunit/va_gov_form_builder/unit/ModuleTest.php
@@ -17,10 +17,38 @@ class ModuleTest extends VaGovUnitTestBase {
/**
* The path to the module being tested.
- *
- * @var string
*/
- private $modulePath = 'modules/custom/va_gov_form_builder';
+ const MODULE_PATH = 'modules/custom/va_gov_form_builder';
+
+ /**
+ * The path to the template directory.
+ */
+ const TEMPLATE_PATH = self::MODULE_PATH . '/templates';
+
+ /**
+ * The path to the page template directory.
+ */
+ const PAGE_TEMPLATE_PATH = self::TEMPLATE_PATH . '/page';
+
+ /**
+ * The path to the page-content template directory.
+ */
+ const PAGE_CONTENT_TEMPLATE_PATH = self::TEMPLATE_PATH . '/page-content';
+
+ /**
+ * The path to the form template directory.
+ */
+ const FORM_TEMPLATE_PATH = self::TEMPLATE_PATH . '/form';
+
+ /**
+ * The prefix for page-content themes.
+ */
+ const PAGE_CONTENT_THEME_PREFIX = 'page_content__va_gov_form_builder__';
+
+ /**
+ * The prefix for form themes.
+ */
+ const FORM_THEME_PREFIX = 'form__va_gov_form_builder__';
/**
* A mock service container.
@@ -41,7 +69,7 @@ protected function setUp(): void {
$drupalRoot = $drupalFinder->getDrupalRoot();
// Require the module file so we can test it.
- require_once $drupalRoot . '/' . $this->modulePath . '/va_gov_form_builder.module';
+ require_once $drupalRoot . '/' . self::MODULE_PATH . '/va_gov_form_builder.module';
// Create the mock service container.
$this->container = new ContainerBuilder();
@@ -50,6 +78,69 @@ protected function setUp(): void {
\Drupal::setContainer($this->container);
}
+ /**
+ * Helper function to assert a form theme.
+ *
+ * @param array $theme
+ * The key of the theme entry to check. This should be
+ * in snake-case.
+ * @param array $themeEntries
+ * The array of theme entries returned from hook_theme.
+ */
+ private function assertTheme($theme, $themeEntries) {
+ // Assert the theme exists.
+ $this->assertArrayHasKey($theme, $themeEntries);
+
+ // Assert the path key exists and is set to the expected value.
+ $this->assertArrayHasKey('path', $themeEntries[$theme]);
+ $this->assertEquals(self::PAGE_CONTENT_TEMPLATE_PATH, $themeEntries[$theme]['path']);
+
+ // Assert the template key exists and is set to the expected value.
+ $themeWithoutPrefix = str_replace(self::PAGE_CONTENT_THEME_PREFIX, '', $theme);
+ $kebabCaseTheme = str_replace('_', '-', $themeWithoutPrefix);
+ $this->assertArrayHasKey('template', $themeEntries[$theme]);
+ $this->assertEquals($kebabCaseTheme, $themeEntries[$theme]['template']);
+ }
+
+ /**
+ * Helper function to make assertions on a non-editable-pattern theme.
+ *
+ * @param array $theme
+ * The key of the theme entry to check. This should be
+ * in snake-case.
+ * @param array $themeEntries
+ * The array of theme entries returned from hook_theme.
+ */
+ private function assertNonEditablePatternTheme($theme, $themeEntries) {
+ // Assert common properties.
+ $this->assertTheme($theme, $themeEntries);
+
+ // Assert variables exist.
+ $this->assertArrayHasKey('variables', $themeEntries[$theme]);
+ $this->assertArrayHasKey('preview', $themeEntries[$theme]['variables']);
+ $this->assertArrayHasKey('alt_text', $themeEntries[$theme]['variables']['preview']);
+ $this->assertArrayHasKey('url', $themeEntries[$theme]['variables']['preview']);
+ $this->assertArrayHasKey('buttons', $themeEntries[$theme]['variables']);
+ }
+
+ /**
+ * Helper function to make assertions on a view-form theme.
+ *
+ * @param array $theme
+ * The key of the theme entry to check. This should be
+ * in snake-case.
+ * @param array $themeEntries
+ * The array of theme entries returned from hook_theme.
+ */
+ private function assertViewFormTheme($theme, $themeEntries) {
+ // Assert common properties.
+ $this->assertTheme($theme, $themeEntries);
+
+ // Assert variables exist.
+ $this->assertArrayHasKey('variables', $themeEntries[$theme]);
+ $this->assertArrayHasKey('buttons', $themeEntries[$theme]['variables']);
+ }
+
/**
* Tests va_gov_form_builder_theme().
*
@@ -61,29 +152,33 @@ public function testVaGovFormBuilderHookTheme() {
NULL,
NULL,
NULL,
- $this->modulePath
+ self::MODULE_PATH
);
// Assert the expected theme definition exists.
// Page (wrapper) theme.
$this->assertArrayHasKey('page__va_gov_form_builder', $result);
$this->assertEquals('page', $result['page__va_gov_form_builder']['base hook']);
- $this->assertEquals($this->modulePath . '/templates/page', $result['page__va_gov_form_builder']['path']);
+ $this->assertEquals(self::PAGE_TEMPLATE_PATH, $result['page__va_gov_form_builder']['path']);
// Page-content themes.
- $page_content_theme_prefix = 'page_content__va_gov_form_builder__';
- $page_content_theme_path = $this->modulePath . '/templates/page-content';
// 1. Home page.
- $homeTheme = $page_content_theme_prefix . 'home';
+ $homeTheme = self::PAGE_CONTENT_THEME_PREFIX . 'home';
$this->assertArrayHasKey($homeTheme, $result);
- $this->assertEquals($page_content_theme_path, $result[$homeTheme]['path']);
+ $this->assertArrayHasKey('path', $result[$homeTheme]);
+ $this->assertEquals(self::PAGE_CONTENT_TEMPLATE_PATH, $result[$homeTheme]['path']);
+ $this->assertArrayHasKey('template', $result[$homeTheme]);
+ $this->assertEquals('home', $result[$homeTheme]['template']);
$this->assertArrayHasKey('variables', $result[$homeTheme]);
$this->assertArrayHasKey('recent_forms', $result[$homeTheme]['variables']);
$this->assertArrayHasKey('build_form_url', $result[$homeTheme]['variables']);
// 2. Layout page.
- $layoutTheme = $page_content_theme_prefix . 'layout';
+ $layoutTheme = self::PAGE_CONTENT_THEME_PREFIX . 'layout';
$this->assertArrayHasKey($layoutTheme, $result);
- $this->assertEquals($page_content_theme_path, $result[$layoutTheme]['path']);
+ $this->assertArrayHasKey('path', $result[$layoutTheme]);
+ $this->assertEquals(self::PAGE_CONTENT_TEMPLATE_PATH, $result[$layoutTheme]['path']);
+ $this->assertArrayHasKey('template', $result[$layoutTheme]);
+ $this->assertEquals('layout', $result[$layoutTheme]['template']);
$this->assertArrayHasKey('variables', $result[$layoutTheme]);
$this->assertArrayHasKey('form_info', $result[$layoutTheme]['variables']);
$this->assertArrayHasKey('intro', $result[$layoutTheme]['variables']);
@@ -94,78 +189,30 @@ public function testVaGovFormBuilderHookTheme() {
$this->assertArrayHasKey('review_and_sign', $result[$layoutTheme]['variables']);
$this->assertArrayHasKey('confirmation', $result[$layoutTheme]['variables']);
$this->assertArrayHasKey('view_form', $result[$layoutTheme]['variables']);
- // 3. Non-editable-pattern-step pages.
- // 3a. Name-and-date-of-birth page.
- $nameAndDobTheme = $page_content_theme_prefix . 'name_and_dob';
- $this->assertArrayHasKey($nameAndDobTheme, $result);
- $this->assertEquals($page_content_theme_path, $result[$nameAndDobTheme]['path']);
- $this->assertArrayHasKey('variables', $result[$nameAndDobTheme]);
- $this->assertArrayHasKey('preview', $result[$nameAndDobTheme]['variables']);
- $this->assertArrayHasKey('alt_text', $result[$nameAndDobTheme]['variables']['preview']);
- $this->assertArrayHasKey('url', $result[$nameAndDobTheme]['variables']['preview']);
- $this->assertArrayHasKey('primary_button', $result[$nameAndDobTheme]['variables']);
- $this->assertArrayHasKey('label', $result[$nameAndDobTheme]['variables']['primary_button']);
- $this->assertArrayHasKey('url', $result[$nameAndDobTheme]['variables']['primary_button']);
- $this->assertArrayHasKey('secondary_button', $result[$nameAndDobTheme]['variables']);
- $this->assertArrayHasKey('label', $result[$nameAndDobTheme]['variables']['secondary_button']);
- $this->assertArrayHasKey('url', $result[$nameAndDobTheme]['variables']['secondary_button']);
- // 3b. Identification-information page.
- $identificationInfoTheme = $page_content_theme_prefix . 'identification_info';
- $this->assertArrayHasKey($identificationInfoTheme, $result);
- $this->assertEquals($page_content_theme_path, $result[$identificationInfoTheme]['path']);
- $this->assertArrayHasKey('variables', $result[$identificationInfoTheme]);
- $this->assertArrayHasKey('preview', $result[$identificationInfoTheme]['variables']);
- $this->assertArrayHasKey('alt_text', $result[$identificationInfoTheme]['variables']['preview']);
- $this->assertArrayHasKey('url', $result[$identificationInfoTheme]['variables']['preview']);
- $this->assertArrayHasKey('primary_button', $result[$identificationInfoTheme]['variables']);
- $this->assertArrayHasKey('label', $result[$identificationInfoTheme]['variables']['primary_button']);
- $this->assertArrayHasKey('url', $result[$identificationInfoTheme]['variables']['primary_button']);
- $this->assertArrayHasKey('secondary_button', $result[$identificationInfoTheme]['variables']);
- $this->assertArrayHasKey('label', $result[$identificationInfoTheme]['variables']['secondary_button']);
- $this->assertArrayHasKey('url', $result[$identificationInfoTheme]['variables']['secondary_button']);
- // 3c. Address-information page.
- $addressInfoTheme = $page_content_theme_prefix . 'address_info';
- $this->assertArrayHasKey($addressInfoTheme, $result);
- $this->assertEquals($page_content_theme_path, $result[$addressInfoTheme]['path']);
- $this->assertArrayHasKey('variables', $result[$addressInfoTheme]);
- $this->assertArrayHasKey('preview', $result[$addressInfoTheme]['variables']);
- $this->assertArrayHasKey('alt_text', $result[$addressInfoTheme]['variables']['preview']);
- $this->assertArrayHasKey('url', $result[$addressInfoTheme]['variables']['preview']);
- $this->assertArrayHasKey('primary_button', $result[$addressInfoTheme]['variables']);
- $this->assertArrayHasKey('label', $result[$addressInfoTheme]['variables']['primary_button']);
- $this->assertArrayHasKey('url', $result[$addressInfoTheme]['variables']['primary_button']);
- // 3d. Contact-information page.
- $contactInfoTheme = $page_content_theme_prefix . 'contact_info';
- $this->assertArrayHasKey($contactInfoTheme, $result);
- $this->assertEquals($page_content_theme_path, $result[$contactInfoTheme]['path']);
- $this->assertArrayHasKey('variables', $result[$contactInfoTheme]);
- $this->assertArrayHasKey('preview', $result[$contactInfoTheme]['variables']);
- $this->assertArrayHasKey('alt_text', $result[$contactInfoTheme]['variables']['preview']);
- $this->assertArrayHasKey('url', $result[$contactInfoTheme]['variables']['preview']);
- $this->assertArrayHasKey('primary_button', $result[$contactInfoTheme]['variables']);
- $this->assertArrayHasKey('label', $result[$contactInfoTheme]['variables']['primary_button']);
- $this->assertArrayHasKey('url', $result[$contactInfoTheme]['variables']['primary_button']);
- // 3e. Review-and-Sign page.
- $reviewAndSignTheme = $page_content_theme_prefix . 'review_and_sign';
- $this->assertArrayHasKey($reviewAndSignTheme, $result);
- $this->assertEquals($page_content_theme_path, $result[$reviewAndSignTheme]['path']);
- $this->assertArrayHasKey('variables', $result[$reviewAndSignTheme]);
- $this->assertArrayHasKey('preview', $result[$reviewAndSignTheme]['variables']);
- $this->assertArrayHasKey('alt_text', $result[$reviewAndSignTheme]['variables']['preview']);
- $this->assertArrayHasKey('url', $result[$reviewAndSignTheme]['variables']['preview']);
- $this->assertArrayHasKey('primary_button', $result[$reviewAndSignTheme]['variables']);
- $this->assertArrayHasKey('label', $result[$reviewAndSignTheme]['variables']['primary_button']);
- $this->assertArrayHasKey('url', $result[$reviewAndSignTheme]['variables']['primary_button']);
+ // 3. Non-editable pattern pages.
+ $nonEditablePatternPages = [
+ 'name_and_dob',
+ 'identification_info',
+ 'address_info',
+ 'contact_info',
+ 'review_and_sign',
+ ];
+ foreach ($nonEditablePatternPages as $nonEditablePatternPage) {
+ $nonEditablePatternPageTheme = self::PAGE_CONTENT_THEME_PREFIX . $nonEditablePatternPage;
+ $this->assertNonEditablePatternTheme($nonEditablePatternPageTheme, $result);
+ }
+ // 4. View-form pages.
+ // 4a. View-form page when viewing form is available.
+ $this->assertViewFormTheme(self::PAGE_CONTENT_THEME_PREFIX . 'view_form__available', $result);
+ // 4b. View-form page when viewing form is unavailable.
+ $this->assertViewFormTheme(self::PAGE_CONTENT_THEME_PREFIX . 'view_form__unavailable', $result);
// Form themes.
- $form_theme_prefix = 'form__va_gov_form_builder__';
- $form_theme_path = $this->modulePath . '/templates/form';
- // Assert all items in array exist.
$form_themes = ['form_info'];
foreach ($form_themes as $form_theme) {
- $this->assertArrayHasKey($form_theme_prefix . $form_theme, $result);
- $this->assertEquals($form_theme_path, $result[$form_theme_prefix . $form_theme]['path']);
- $this->assertEquals('form', $result[$form_theme_prefix . $form_theme]['render element']);
+ $this->assertArrayHasKey(self::FORM_THEME_PREFIX . $form_theme, $result);
+ $this->assertEquals(self::FORM_TEMPLATE_PATH, $result[self::FORM_THEME_PREFIX . $form_theme]['path']);
+ $this->assertEquals('form', $result[self::FORM_THEME_PREFIX . $form_theme]['render element']);
}
}
From b1fa4b1a43e75653ec8d0247771752730b167090 Mon Sep 17 00:00:00 2001
From: Daniel Sasser <221539+dsasser@users.noreply.github.com>
Date: Fri, 28 Feb 2025 08:08:48 -0800
Subject: [PATCH 3/9] =?UTF-8?q?VACMS-20435:=20Updates=20description=20meta?=
=?UTF-8?q?=20tag=20for=20va=20forms=20to=20use=20field=5Fv=E2=80=A6=20(#2?=
=?UTF-8?q?0709)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* VACMS-20435: Updates description meta tag for va forms to use field_va_form_name.
* VACMS-20435: Removes meta tag field from VA Forms.
* VACMS-20435: Restore revision_log that was not intended to be removed.
---
...tity_form_display.node.va_form.default.yml | 3 +--
...tity_view_display.node.va_form.default.yml | 9 --------
..._display.node.va_form.external_content.yml | 2 --
...ntity_view_display.node.va_form.teaser.yml | 2 --
...eld.field.node.va_form.field_meta_tags.yml | 21 -------------------
...metatag.metatag_defaults.node__va_form.yml | 2 +-
6 files changed, 2 insertions(+), 37 deletions(-)
delete mode 100644 config/sync/field.field.node.va_form.field_meta_tags.yml
diff --git a/config/sync/core.entity_form_display.node.va_form.default.yml b/config/sync/core.entity_form_display.node.va_form.default.yml
index a8022375a6..234a7554d4 100644
--- a/config/sync/core.entity_form_display.node.va_form.default.yml
+++ b/config/sync/core.entity_form_display.node.va_form.default.yml
@@ -8,7 +8,6 @@ dependencies:
- field.field.node.va_form.field_alert
- field.field.node.va_form.field_benefit_categories
- field.field.node.va_form.field_last_saved_by_an_editor
- - field.field.node.va_form.field_meta_tags
- field.field.node.va_form.field_va_form_administration
- field.field.node.va_form.field_va_form_deleted
- field.field.node.va_form.field_va_form_deleted_date
@@ -161,6 +160,7 @@ content:
field_widget_display_settings:
view_mode: default
selection_mode: selection_append
+ show_latest_revision: false
third_party_settings: { }
field_benefit_categories:
type: options_buttons
@@ -352,7 +352,6 @@ content:
third_party_settings: { }
hidden:
created: true
- field_meta_tags: true
langcode: true
promote: true
status: true
diff --git a/config/sync/core.entity_view_display.node.va_form.default.yml b/config/sync/core.entity_view_display.node.va_form.default.yml
index 2dcf6b2f3f..fcfb4e024c 100644
--- a/config/sync/core.entity_view_display.node.va_form.default.yml
+++ b/config/sync/core.entity_view_display.node.va_form.default.yml
@@ -7,7 +7,6 @@ dependencies:
- field.field.node.va_form.field_alert
- field.field.node.va_form.field_benefit_categories
- field.field.node.va_form.field_last_saved_by_an_editor
- - field.field.node.va_form.field_meta_tags
- field.field.node.va_form.field_va_form_administration
- field.field.node.va_form.field_va_form_deleted
- field.field.node.va_form.field_va_form_deleted_date
@@ -32,7 +31,6 @@ dependencies:
- entity_reference_revisions
- field_group
- link
- - metatag
- options
- text
- user
@@ -107,13 +105,6 @@ content:
third_party_settings: { }
weight: 18
region: content
- field_meta_tags:
- type: metatag_empty_formatter
- label: above
- settings: { }
- third_party_settings: { }
- weight: 1
- region: content
field_va_form_language:
type: list_default
label: above
diff --git a/config/sync/core.entity_view_display.node.va_form.external_content.yml b/config/sync/core.entity_view_display.node.va_form.external_content.yml
index d886d72a71..32d46d2ec5 100644
--- a/config/sync/core.entity_view_display.node.va_form.external_content.yml
+++ b/config/sync/core.entity_view_display.node.va_form.external_content.yml
@@ -8,7 +8,6 @@ dependencies:
- field.field.node.va_form.field_alert
- field.field.node.va_form.field_benefit_categories
- field.field.node.va_form.field_last_saved_by_an_editor
- - field.field.node.va_form.field_meta_tags
- field.field.node.va_form.field_va_form_administration
- field.field.node.va_form.field_va_form_deleted
- field.field.node.va_form.field_va_form_deleted_date
@@ -165,7 +164,6 @@ hidden:
field_alert: true
field_benefit_categories: true
field_last_saved_by_an_editor: true
- field_meta_tags: true
field_va_form_language: true
field_va_form_link_teasers: true
field_va_form_name: true
diff --git a/config/sync/core.entity_view_display.node.va_form.teaser.yml b/config/sync/core.entity_view_display.node.va_form.teaser.yml
index 5e507171db..fc8ac0b94a 100644
--- a/config/sync/core.entity_view_display.node.va_form.teaser.yml
+++ b/config/sync/core.entity_view_display.node.va_form.teaser.yml
@@ -8,7 +8,6 @@ dependencies:
- field.field.node.va_form.field_alert
- field.field.node.va_form.field_benefit_categories
- field.field.node.va_form.field_last_saved_by_an_editor
- - field.field.node.va_form.field_meta_tags
- field.field.node.va_form.field_va_form_administration
- field.field.node.va_form.field_va_form_deleted
- field.field.node.va_form.field_va_form_deleted_date
@@ -48,7 +47,6 @@ hidden:
field_alert: true
field_benefit_categories: true
field_last_saved_by_an_editor: true
- field_meta_tags: true
field_va_form_administration: true
field_va_form_deleted: true
field_va_form_deleted_date: true
diff --git a/config/sync/field.field.node.va_form.field_meta_tags.yml b/config/sync/field.field.node.va_form.field_meta_tags.yml
deleted file mode 100644
index 1a834f8aef..0000000000
--- a/config/sync/field.field.node.va_form.field_meta_tags.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-uuid: c0a12886-2003-4adf-8ecf-4f02a56be682
-langcode: en
-status: true
-dependencies:
- config:
- - field.storage.node.field_meta_tags
- - node.type.va_form
- module:
- - metatag
-id: node.va_form.field_meta_tags
-field_name: field_meta_tags
-entity_type: node
-bundle: va_form
-label: 'Meta tags'
-description: ''
-required: false
-translatable: false
-default_value: { }
-default_value_callback: ''
-settings: { }
-field_type: metatag
diff --git a/config/sync/metatag.metatag_defaults.node__va_form.yml b/config/sync/metatag.metatag_defaults.node__va_form.yml
index b208716166..0ddff7e3de 100644
--- a/config/sync/metatag.metatag_defaults.node__va_form.yml
+++ b/config/sync/metatag.metatag_defaults.node__va_form.yml
@@ -5,4 +5,4 @@ dependencies: { }
id: node__va_form
label: 'Content: VA form'
tags:
- description: '[node:field_va_form_usage:value]'
+ description: '[node:field_va_form_name:value]'
From 8873abe0299e5cad86bbaf2147da618ad8b4e09f Mon Sep 17 00:00:00 2001
From: Edmund Dunn <109987005+edmund-dunn@users.noreply.github.com>
Date: Fri, 28 Feb 2025 09:08:38 -0800
Subject: [PATCH 4/9] VACMS-20672: fix deploy shield, added response (#20733)
* VACMS-20672: fix deploy shield, added response
* VACMS-20672: fix spacing
---
.../va_gov_backend/src/Deploy/Plugin/MaintenanceMode.php | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/docroot/modules/custom/va_gov_backend/src/Deploy/Plugin/MaintenanceMode.php b/docroot/modules/custom/va_gov_backend/src/Deploy/Plugin/MaintenanceMode.php
index 03b3517b70..208b6a3c8e 100644
--- a/docroot/modules/custom/va_gov_backend/src/Deploy/Plugin/MaintenanceMode.php
+++ b/docroot/modules/custom/va_gov_backend/src/Deploy/Plugin/MaintenanceMode.php
@@ -4,6 +4,7 @@
use Drupal\va_gov_backend\Deploy\LoadMaintenanceFileTrait;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
/**
@@ -30,8 +31,12 @@ public function run(Request $request, string $app_root, string $site_path) {
$html = preg_replace('/\{\{\s*update_duration\s*\}\}/', $expected_update_duration, $html);
$headers = [
'Content-Type' => 'text/html',
+ 'Retry-After' => 120,
];
- throw new ServiceUnavailableHttpException(120, $html, NULL, 503, $headers);
+ $response = new Response($html, 503, $headers);
+ $response->send();
+ // We need to throw an exception to stop the request.
+ throw new ServiceUnavailableHttpException();
}
}
From 15b6274d663a2535661f24bde368ee02fad4e967 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 28 Feb 2025 09:08:54 -0800
Subject: [PATCH 5/9] Bump masci/datadog from 1.7.1 to 1.8.0 (#20728)
Bumps [masci/datadog](https://github.com/masci/datadog) from 1.7.1 to 1.8.0.
- [Release notes](https://github.com/masci/datadog/releases)
- [Commits](https://github.com/masci/datadog/compare/a5d283e78e33a688ed08a96ba64440505e645a8c...748e7a8235b5dd4f467cc27dc77cc0c71d78563b)
---
updated-dependencies:
- dependency-name: masci/datadog
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edmund Dunn <109987005+edmund-dunn@users.noreply.github.com>
---
.github/workflows/default-branch-datadog-metrics.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/default-branch-datadog-metrics.yml b/.github/workflows/default-branch-datadog-metrics.yml
index 5d167b3c65..02ed4ffd23 100644
--- a/.github/workflows/default-branch-datadog-metrics.yml
+++ b/.github/workflows/default-branch-datadog-metrics.yml
@@ -58,7 +58,7 @@ jobs:
env:
GITHUB_REPOSITORY: "${{ github.repository }}"
- name: Send Metrics to DataDog.
- uses: masci/datadog@a5d283e78e33a688ed08a96ba64440505e645a8c # v1.7.1
+ uses: masci/datadog@748e7a8235b5dd4f467cc27dc77cc0c71d78563b # v1.8.0
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
api-url: https://api.ddog-gov.com
@@ -150,7 +150,7 @@ jobs:
echo "Lines Denominator: ${lines_denominator}";
- name: Send Metrics to DataDog.
- uses: masci/datadog@a5d283e78e33a688ed08a96ba64440505e645a8c # v1.7.1
+ uses: masci/datadog@748e7a8235b5dd4f467cc27dc77cc0c71d78563b # v1.8.0
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
api-url: https://api.ddog-gov.com
@@ -271,7 +271,7 @@ jobs:
echo "nonpublic_class_constants=$(jq '.nonPublicClassConstants' phploc.json)" >> $GITHUB_OUTPUT
- name: Send Metrics to DataDog.
- uses: masci/datadog@a5d283e78e33a688ed08a96ba64440505e645a8c # v1.7.1
+ uses: masci/datadog@748e7a8235b5dd4f467cc27dc77cc0c71d78563b # v1.8.0
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
api-url: https://api.ddog-gov.com
From 0d5ab18f59dd43fde92b481dd713b4a8cf8fea4d Mon Sep 17 00:00:00 2001
From: Daniel Sasser <221539+dsasser@users.noreply.github.com>
Date: Fri, 28 Feb 2025 09:29:17 -0800
Subject: [PATCH 6/9] VACMS-20499: Updatdes CLP default metatag to include
description. (#20715)
* VACMS-20499: Updatdes CLP default metatag to include description derived from the field_clp_why_this_matters field.
* VACMS-20499: Use correct description for CLP metatags.
---
.../metatag.metatag_defaults.node__campaign_landing_page.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/sync/metatag.metatag_defaults.node__campaign_landing_page.yml b/config/sync/metatag.metatag_defaults.node__campaign_landing_page.yml
index 18364adc25..24b7f8872d 100644
--- a/config/sync/metatag.metatag_defaults.node__campaign_landing_page.yml
+++ b/config/sync/metatag.metatag_defaults.node__campaign_landing_page.yml
@@ -5,5 +5,6 @@ dependencies: { }
id: node__campaign_landing_page
label: 'Content: Campaign Landing Page'
tags:
+ description: '[node:field_clp_why_this_matters:value]'
og_image: '[node:field_hero_image:entity:image:3_2_medium_thumbnail:url]'
twitter_cards_image: '[node:field_hero_image:entity:image:3_2_medium_thumbnail:url]'
From 87324f2e11283e4698527a1857683077b757e1b2 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 28 Feb 2025 10:36:47 -0800
Subject: [PATCH 7/9] Bump cypress-io/github-action from 6.7.12 to 6.7.13
(#20729)
Bumps [cypress-io/github-action](https://github.com/cypress-io/github-action) from 6.7.12 to 6.7.13.
- [Release notes](https://github.com/cypress-io/github-action/releases)
- [Changelog](https://github.com/cypress-io/github-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/cypress-io/github-action/compare/18a6541367f4580a515371905f499a27a44e8dbe...1052aa98bbbe4f55210f844878213c07d9c8c399)
---
updated-dependencies:
- dependency-name: cypress-io/github-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edmund Dunn <109987005+edmund-dunn@users.noreply.github.com>
---
.github/workflows/cypress.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml
index aed5c27de2..f864eba519 100644
--- a/.github/workflows/cypress.yml
+++ b/.github/workflows/cypress.yml
@@ -47,7 +47,7 @@ jobs:
NODE_TLS_REJECT_UNAUTHORIZED: 0
- name: Cypress run
- uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12
+ uses: cypress-io/github-action@1052aa98bbbe4f55210f844878213c07d9c8c399 # v6.7.13
with:
wait-on: "${{ inputs.preview_url }}"
command: 'npm run test:cypress:parallel'
From ae6b6ff15b2c66920c86748cbd9ff14625d00cb5 Mon Sep 17 00:00:00 2001
From: Jill Adams <85581471+jilladams@users.noreply.github.com>
Date: Fri, 28 Feb 2025 14:56:01 -0800
Subject: [PATCH 8/9] VACMS-20678 Remove references to Lighthouse CSV (#20679)
Lighthouse is deprecating their CSV for canonical URLs.
Drupal URLs will be the source of truth moving forward.
---
.../runbook-facility-url-change.md | 19 ++++---------------
.../runbook-vamc-facility-new.md | 15 +++++----------
.../ISSUE_TEMPLATE/runbook-vet-center-new.md | 15 +++++----------
3 files changed, 14 insertions(+), 35 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE/runbook-facility-url-change.md b/.github/ISSUE_TEMPLATE/runbook-facility-url-change.md
index 245196059a..c256985d8c 100644
--- a/.github/ISSUE_TEMPLATE/runbook-facility-url-change.md
+++ b/.github/ISSUE_TEMPLATE/runbook-facility-url-change.md
@@ -20,7 +20,7 @@ When does this request need to be live:
- [ ] Link the related facility closure / rename issue.
- [ ] Create a URL redirect in the [vsp-platform-revproxy](https://github.com/department-of-veterans-affairs/vsp-platform-revproxy) repo in `template-rendering/revproxy-vagov/vars/redirects.yml`
- [ ] Add the "Awaiting redirect" flag to the facility node with a revision log message that includes a link to this ticket, preserving the node's current moderation state.
-- [ ] Redirects deploy daily except Friday at 10am ET, or by requesting OOB deploy (of the revproxy job to prod) in #vfs-platform-support. After deploy, validate that the URL redirect is deployed. (Note: In the event of a facility closure or a name change, validate that this occurs before making the Lighthouse csv changes.)
+- [ ] Redirects deploy daily except Friday at 10am ET, or by requesting OOB deploy (of the revproxy job to prod) in #vfs-platform-support. After deploy, validate that the URL redirect is deployed.
- [ ] Update this ticket with a comment that the redirect has been deployed.
- [ ] Remove the "Awaiting redirect" flag on the facility node with a revision log message that includes a link to this ticket, preserving the node's current moderation state.
- [ ] Notify helpdesk via comment on ticket or Slack message in #cms-support that changes are ready for review.
@@ -37,14 +37,9 @@ When does this request need to be live:
### Instructions for canonical URL change
- [ ] Verify that the new URL for the facility is published and accessible on VA.gov.
-- [ ] Contact Lighthouse via Slack at #cms-lighthouse channel that this facility requires a canonical link in the following format (replacing the placeholder data with the actual API Id and VA.gov URL):
- - `vha_691GM,https://www.va.gov/greater-los-angeles-health-care/locations/oxnard-va-clinic/`
-- [ ] Add the "Awaiting CSV" flag to the facility node with a revision log message that includes a link to this ticket.
-- [ ] Let Help desk know this has been done, if not done by Help desk.
-#### Wait (days or weeks, potentially)
-- [ ] After the canonical link has been added to the websites.csv and you have confirmation from Lighthouse that the CSV has been deployed, validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
-- [ ] Update this ticket with a comment that the CSV change has been deployed.
+#### After next nightly Facilities migration to Lighthouse
+- [ ] Validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
#### URL change example (update with actual ID and URL)
| Facility API ID | Full VA.gov URL |
@@ -53,13 +48,7 @@ When does this request need to be live:
### 2. Canonical URL removal (if removed from VAST)
### Instructions for canonical URL removal
-- [ ] Try to find the facility via the Facility Locator, using the Facility API ID (e.g. https://va.gov/find-locations/facility/"facility_api_id"). If it is not available, proceed.
-- [ ] Contact Lighthouse via Slack at #cms-lighthouse channel that this facility requires a canonical link to be removed in the following format (replacing the placeholder data with the actual API Id and VA.gov URL):
- - `vha_691GM,https://www.va.gov/greater-los-angeles-health-care/locations/oxnard-va-clinic/`
+- [ ] Try to find the facility via the Facility Locator, using the Facility API ID (e.g. https://va.gov/find-locations/facility/"facility_api_id"). If it is not available, close this ticket.
**Note: there's no check to see if it's not returning anything, as it should already be not showing anything in the Facility Locator.**
-#### URL removal example (update with actual ID and URL to remove)
-| Facility API ID | Full VA.gov URL |
-| --- | --- |
-| vha_691GM | https://www.va.gov/greater-los-angeles-health-care/locations/oxnard-va-clinic |
diff --git a/.github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md b/.github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md
index 1f2478ab3f..dd85948518 100644
--- a/.github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md
+++ b/.github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md
@@ -58,19 +58,14 @@ Please let us know when your draft content is complete, so that we can wrap up t
- [ ] When editor has prepared content and let help desk know, proceed to the remaining steps.
-#### Drupal Admin steps (CMS Engineer or Help desk) _Help desk will complete these steps or escalate to request help from CMS engineering._
+#### Drupal Admin steps (_Help desk will complete these steps or escalate to request help from CMS engineering._)
- [ ] Update the facility **Meta description** field, using the following format: "Get address and hours, parking and transportation information, and health services offered at [facility name]."
- [ ] Move the facility link in the health care system menu to its place in the alphabetized list (medical centers first, then clinics).
- [ ] Drupal Admin bulk publishes nodes and facility.
-- [ ] Contact Lighthouse via Slack at #cms-lighthouse channel that this facility requires a canonical link in the following format (replace the placeholder data with the actual API Id and VA.gov URL):
- - `vha_XXX`,https://www.va.gov/SYSTEM-health-care/locations/PATH/`
-- [ ] Add the "Awaiting CSV" flag to the facility node with a revision log message that includes a link to this ticket.
-- [ ] Let Help desk know this has been done, if not done by Help desk.
-
-#### Wait (days or weeks, potentially)
-- [ ] After the canonical link has been added to the websites.csv and you have confirmation from Lighthouse that the CSV has been deployed, validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
-- [ ] Update this ticket with a comment that the CSV change has been deployed.
-- [ ] Edit facility node and remove `New facility` and "Awaiting CSV" flags with a revision log message that includes a link to this ticket.
+
+#### After the next nightly Facilities migration to Lighthouse
+- [ ] Validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
+- [ ] Edit facility node and remove `New facility` flag with a revision log message that includes a link to this ticket.
#### CMS Help desk (wrap up)
- [ ] Notify editor and any other stakeholders.
diff --git a/.github/ISSUE_TEMPLATE/runbook-vet-center-new.md b/.github/ISSUE_TEMPLATE/runbook-vet-center-new.md
index 0e19c32246..01a9d94dc5 100644
--- a/.github/ISSUE_TEMPLATE/runbook-vet-center-new.md
+++ b/.github/ISSUE_TEMPLATE/runbook-vet-center-new.md
@@ -61,17 +61,12 @@ Facility API ID:
**Drupal Admin steps**
- [ ] Bulk publish the nodes and facility.
-- [ ] Contact Lighthouse via Slack at #cms-lighthouse channel that this facility requires a canonical link in the following format (replacing the placeholder data with the actual API Id and VA.gov URL):
- - `vha_691GM,https://www.va.gov/greater-los-angeles-health-care/locations/oxnard-va-clinic/`
-- [ ] Add the "Awaiting CSV" flag to the facility node with a revision log message that includes a link to this ticket.
-- [ ] Let Help desk know this has been done, if not done by Help desk.
-#### Wait (days or weeks, potentially)
-- [ ] After the canonical link has been added to the websites.csv and you have confirmation from Lighthouse that the CSV has been deployed, validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
-- [ ] Update this ticket with a comment that the CSV change has been deployed.
-- [ ] Edit facility node and remove `New facility` and "Awaiting CSV" flags with a revision log message that includes a link to this ticket.
+#### After next nightly Facilities migration to Lighthouse
+- [ ] Validate that the change has deployed by checking that the Facility Locator has been updated with the new url.
+- [ ] Edit facility node and remove `New facility` flag with a revision log message that includes a link to this ticket.
- [ ] Let Help desk know this has been done, if not done by Help desk.
#### CMS Help desk (wrap up)
-- [ ] 11. Upgrade the Vet Center Director and Outreach Specialist accounts to the publisher role for that Vet Center.
-- [ ] 12. Notify editor and any other stakeholders.
+- [ ] Upgrade the Vet Center Director and Outreach Specialist accounts to the publisher role for that Vet Center.
+- [ ] Notify editor and any other stakeholders.
From bd466ed430d62d1c76131e23fa8597e0b861a267 Mon Sep 17 00:00:00 2001
From: Christian Burk <766573+omahane@users.noreply.github.com>
Date: Mon, 3 Mar 2025 09:31:38 -0600
Subject: [PATCH 9/9] VACMS-20371: Clean up extensions (#20730)
* VACMS-20371: Clean up extensions
* VACMS-20371: Adds a couple more guard clauses.
* VACMS-20371: Adds more defensive code.
* VACMS-20371: Adds a different defense in light of PHPStan
* VACMS-20371: Adds case insensitivity to the patterns for split numbers
---
...veNonNumericalCharactersFromExtensions.php | 13 +++++++++----
.../SplitExtensionWithTwoNumbers.php | 19 ++++++++++++++-----
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/docroot/modules/custom/va_gov_batch/src/cbo_scripts/RemoveNonNumericalCharactersFromExtensions.php b/docroot/modules/custom/va_gov_batch/src/cbo_scripts/RemoveNonNumericalCharactersFromExtensions.php
index 7e17af32bc..d04c3907b9 100644
--- a/docroot/modules/custom/va_gov_batch/src/cbo_scripts/RemoveNonNumericalCharactersFromExtensions.php
+++ b/docroot/modules/custom/va_gov_batch/src/cbo_scripts/RemoveNonNumericalCharactersFromExtensions.php
@@ -72,16 +72,21 @@ public function processOne(string $key, mixed $item, array &$sandbox): string {
if (empty($original_extension)) {
return "No extension found for paragraph id $item";
}
+ $phone_parent_field_name = $phone_paragraph->get('parent_field_name')->value;
+ // Don't try to change 'field_phone_numbers_paragraph'.
+ if ($phone_parent_field_name === 'field_phone_numbers_paragraph') {
+ return "The phone data from 'field_phone_numbers_paragraph' '$item' on 'health_care_local_health_service' has already been migrated to the Service location paragraph previously. This is a vestigial field that is unused.";
+ }
$number_only_extension = $this->replaceNonNumerals($original_extension);
if ($original_extension === $number_only_extension) {
- return "No change to extension $original_extension in paragraph id $item";
+ return "No change to extension '$original_extension' in paragraph id $item";
}
$phone_paragraph->set(name: 'field_phone_extension', value: $number_only_extension);
$phone_paragraph->save();
return "Extension updated for paragraph id $item from '$original_extension' to '$number_only_extension'";
}
catch (\Exception $e) {
- $message = "Exception during update of paragraph id $item with extension: $original_extension";
+ $message = "Exception during update of paragraph id $item with extension: '$original_extension'";
return $message;
}
@@ -98,7 +103,7 @@ public function processOne(string $key, mixed $item, array &$sandbox): string {
*/
public static function replaceNonNumerals(string $extension): string {
- $pattern_to_ignore = '/(^\d+[,|;]\s?\d+)|(^\d+\sor\s\d+)|(^\d+\/\d+)|(^\d+\sthen\s\d+)/';
+ $pattern_to_ignore = '/(^\d+[,|;]\s?\d+)|(^\d+\sor\s\d+)|(^\d+\/\d+)|(^\d+\sthen\s\d+)/i';
// If the extension contains two numbers separate numbers, don't change it.
if (preg_match($pattern_to_ignore, $extension) > 0) {
@@ -106,7 +111,7 @@ public static function replaceNonNumerals(string $extension): string {
}
// Remove non-numerical characters from the extension.
- $just_numbers = preg_replace('/[^0-9]/', '', $extension);
+ $just_numbers = trim(preg_replace('/[^0-9]/', '', $extension));
return $just_numbers;
}
diff --git a/docroot/modules/custom/va_gov_batch/src/cbo_scripts/SplitExtensionWithTwoNumbers.php b/docroot/modules/custom/va_gov_batch/src/cbo_scripts/SplitExtensionWithTwoNumbers.php
index 26cc155267..7305fb2084 100644
--- a/docroot/modules/custom/va_gov_batch/src/cbo_scripts/SplitExtensionWithTwoNumbers.php
+++ b/docroot/modules/custom/va_gov_batch/src/cbo_scripts/SplitExtensionWithTwoNumbers.php
@@ -86,6 +86,10 @@ public function processOne(string $key, mixed $item, array &$sandbox): string {
// Do the extension work.
$original_extension = $phone_paragraph->get('field_phone_extension')->value;
$separated_extensions = $this->splitExtensions($original_extension);
+ // There is something amiss with the extensions.
+ if (empty($separated_extensions)) {
+ return "Either no change is necessary for paragraph $item or '$original_extension' cannot be successfully separated.";
+ }
$original_label = $phone_paragraph->get('field_phone_label')->value;
try {
@@ -96,7 +100,7 @@ public function processOne(string $key, mixed $item, array &$sandbox): string {
}
$phone_paragraph->set(name: 'field_phone_extension', value: $separated_extensions[0]);
$phone_paragraph->save();
- $message = "1st extension for paragraph $item changed from '$original_extension' to $separated_extensions[0]' .";
+ $message = "1st extension for paragraph $item changed from '$original_extension' to '$separated_extensions[0]'. ";
}
// Create the second extension and phone.
@@ -116,7 +120,7 @@ public function processOne(string $key, mixed $item, array &$sandbox): string {
$phone_parent_paragraph = \Drupal::entityTypeManager()->getStorage('paragraph')->load($phone_parent_id);
$phone_parent_paragraph->get($phone_parent_field_name)->appendItem($second_phone);
$phone_parent_paragraph->save();
- $message .= "2nd extension created for paragraph $second_phone_id from '$original_extension' to $separated_extensions[1]'." . PHP_EOL;
+ $message .= "2nd extension created for paragraph $second_phone_id from '$original_extension' to '$separated_extensions[1]'.";
}
}
catch (\Exception $e) {
@@ -133,20 +137,25 @@ public function processOne(string $key, mixed $item, array &$sandbox): string {
* @param string $dual_extension
* The two-part extension.
*
- * @return array
+ * @return array|bool
* Array with two extensions (or empty).
* E.g. '2132,2995' becomes ['2132','2995']
*/
public static function splitExtensions(string $dual_extension): array {
- if (!preg_match('/[^0-9]/', $dual_extension)) {
+ $pattern = '/(^\d+[,|;]\s?\d+)|(^\d+\sor\s\d+)|(^\d+\/\d+)|(^\d+\sthen\s\d+)/i';
+ if (!preg_match($pattern, $dual_extension)) {
return [];
}
$first_extension = [];
preg_match('/^\d+/', $dual_extension, $first_extension);
$second_extension = [];
preg_match('/\d+$/', $dual_extension, $second_extension);
+ // If either of these are empty, we want to bail out of this.
+ if (empty($first_extension[0]) or empty($second_extension[0])) {
+ return [];
+ }
- return [$first_extension[0], $second_extension[0]];
+ return [trim($first_extension[0]), trim($second_extension[0])];
}
}