diff --git a/config/sync/core.entity_form_display.node.campaign_landing_page.default.yml b/config/sync/core.entity_form_display.node.campaign_landing_page.default.yml index f81c6960b7..f2baefb38b 100644 --- a/config/sync/core.entity_form_display.node.campaign_landing_page.default.yml +++ b/config/sync/core.entity_form_display.node.campaign_landing_page.default.yml @@ -43,7 +43,6 @@ dependencies: - field.field.node.campaign_landing_page.field_last_saved_by_an_editor - field.field.node.campaign_landing_page.field_media - field.field.node.campaign_landing_page.field_primary_call_to_action - - field.field.node.campaign_landing_page.field_related_office - field.field.node.campaign_landing_page.field_secondary_call_to_action - node.type.campaign_landing_page - workflows.workflow.editorial @@ -892,7 +891,6 @@ content: third_party_settings: { } hidden: created: true - field_related_office: true langcode: true promote: true sticky: true diff --git a/config/sync/core.entity_form_display.node.landing_page.default.yml b/config/sync/core.entity_form_display.node.landing_page.default.yml index 00a4b34063..b3195beff9 100644 --- a/config/sync/core.entity_form_display.node.landing_page.default.yml +++ b/config/sync/core.entity_form_display.node.landing_page.default.yml @@ -17,7 +17,6 @@ dependencies: - field.field.node.landing_page.field_plainlanguage_date - field.field.node.landing_page.field_promo - field.field.node.landing_page.field_related_links - - field.field.node.landing_page.field_related_office - field.field.node.landing_page.field_spokes - field.field.node.landing_page.field_support_services - field.field.node.landing_page.field_teaser_text @@ -346,7 +345,6 @@ hidden: created: true field_meta_tags: true field_plainlanguage_date: true - field_related_office: true langcode: true promote: true status: true diff --git a/config/sync/core.entity_form_display.node.office.default.yml b/config/sync/core.entity_form_display.node.office.default.yml index c7a650f6fe..8a366dc84e 100644 --- a/config/sync/core.entity_form_display.node.office.default.yml +++ b/config/sync/core.entity_form_display.node.office.default.yml @@ -6,13 +6,10 @@ dependencies: - field.field.node.office.field_administration - field.field.node.office.field_body - field.field.node.office.field_description - - field.field.node.office.field_email_updates_link - - field.field.node.office.field_external_link - field.field.node.office.field_last_saved_by_an_editor - field.field.node.office.field_meta_tags - field.field.node.office.field_office_id - field.field.node.office.field_parent_office - - field.field.node.office.field_social_media_links - node.type.office - workflows.workflow.editorial module: @@ -168,6 +165,11 @@ content: size: 60 placeholder: '' third_party_settings: { } + translation: + weight: 10 + region: content + settings: { } + third_party_settings: { } url_redirects: weight: 6 region: content @@ -175,10 +177,7 @@ content: third_party_settings: { } hidden: created: true - field_email_updates_link: true - field_external_link: true field_meta_tags: true - field_social_media_links: true langcode: true promote: true status: true diff --git a/config/sync/core.entity_view_display.node.campaign_landing_page.default.yml b/config/sync/core.entity_view_display.node.campaign_landing_page.default.yml index c70a7b5543..e9be40dcea 100644 --- a/config/sync/core.entity_view_display.node.campaign_landing_page.default.yml +++ b/config/sync/core.entity_view_display.node.campaign_landing_page.default.yml @@ -41,7 +41,6 @@ dependencies: - field.field.node.campaign_landing_page.field_last_saved_by_an_editor - field.field.node.campaign_landing_page.field_media - field.field.node.campaign_landing_page.field_primary_call_to_action - - field.field.node.campaign_landing_page.field_related_office - field.field.node.campaign_landing_page.field_secondary_call_to_action - image.style.7_2_medium_thumbnail - node.type.campaign_landing_page @@ -506,7 +505,6 @@ hidden: field_clp_stories_panel: true field_clp_video_panel: true field_last_saved_by_an_editor: true - field_related_office: true langcode: true links: true search_api_excerpt: true diff --git a/config/sync/core.entity_view_display.node.campaign_landing_page.teaser.yml b/config/sync/core.entity_view_display.node.campaign_landing_page.teaser.yml index ac5943fec6..07fb8d0df9 100644 --- a/config/sync/core.entity_view_display.node.campaign_landing_page.teaser.yml +++ b/config/sync/core.entity_view_display.node.campaign_landing_page.teaser.yml @@ -42,7 +42,6 @@ dependencies: - field.field.node.campaign_landing_page.field_last_saved_by_an_editor - field.field.node.campaign_landing_page.field_media - field.field.node.campaign_landing_page.field_primary_call_to_action - - field.field.node.campaign_landing_page.field_related_office - field.field.node.campaign_landing_page.field_secondary_call_to_action - node.type.campaign_landing_page module: @@ -102,7 +101,6 @@ hidden: field_last_saved_by_an_editor: true field_media: true field_primary_call_to_action: true - field_related_office: true field_secondary_call_to_action: true langcode: true search_api_excerpt: true diff --git a/config/sync/core.entity_view_display.node.landing_page.default.yml b/config/sync/core.entity_view_display.node.landing_page.default.yml index e1e8b48025..cd37c0b69f 100644 --- a/config/sync/core.entity_view_display.node.landing_page.default.yml +++ b/config/sync/core.entity_view_display.node.landing_page.default.yml @@ -15,7 +15,6 @@ dependencies: - field.field.node.landing_page.field_plainlanguage_date - field.field.node.landing_page.field_promo - field.field.node.landing_page.field_related_links - - field.field.node.landing_page.field_related_office - field.field.node.landing_page.field_spokes - field.field.node.landing_page.field_support_services - field.field.node.landing_page.field_teaser_text @@ -224,7 +223,6 @@ hidden: field_last_saved_by_an_editor: true field_meta_tags: true field_plainlanguage_date: true - field_related_office: true langcode: true links: true search_api_excerpt: true diff --git a/config/sync/core.entity_view_display.node.landing_page.support_services_listing.yml b/config/sync/core.entity_view_display.node.landing_page.support_services_listing.yml index 23e62b6811..6ec3165a91 100644 --- a/config/sync/core.entity_view_display.node.landing_page.support_services_listing.yml +++ b/config/sync/core.entity_view_display.node.landing_page.support_services_listing.yml @@ -16,7 +16,6 @@ dependencies: - field.field.node.landing_page.field_plainlanguage_date - field.field.node.landing_page.field_promo - field.field.node.landing_page.field_related_links - - field.field.node.landing_page.field_related_office - field.field.node.landing_page.field_spokes - field.field.node.landing_page.field_support_services - field.field.node.landing_page.field_teaser_text @@ -112,7 +111,6 @@ hidden: field_plainlanguage_date: true field_promo: true field_related_links: true - field_related_office: true field_spokes: true field_teaser_text: true field_title_icon: true diff --git a/config/sync/core.entity_view_display.node.landing_page.teaser.yml b/config/sync/core.entity_view_display.node.landing_page.teaser.yml index 91de8bcb92..a1816c6746 100644 --- a/config/sync/core.entity_view_display.node.landing_page.teaser.yml +++ b/config/sync/core.entity_view_display.node.landing_page.teaser.yml @@ -16,7 +16,6 @@ dependencies: - field.field.node.landing_page.field_plainlanguage_date - field.field.node.landing_page.field_promo - field.field.node.landing_page.field_related_links - - field.field.node.landing_page.field_related_office - field.field.node.landing_page.field_spokes - field.field.node.landing_page.field_support_services - field.field.node.landing_page.field_teaser_text @@ -69,7 +68,6 @@ hidden: field_plainlanguage_date: true field_promo: true field_related_links: true - field_related_office: true field_spokes: true field_support_services: true field_title_icon: true diff --git a/config/sync/core.entity_view_display.node.office.connect_with_us.yml b/config/sync/core.entity_view_display.node.office.connect_with_us.yml deleted file mode 100644 index ceba84a6ce..0000000000 --- a/config/sync/core.entity_view_display.node.office.connect_with_us.yml +++ /dev/null @@ -1,70 +0,0 @@ -uuid: f3b691b1-f070-4bcb-b076-b9b05d6eacd2 -langcode: en -status: true -dependencies: - config: - - core.entity_view_mode.node.connect_with_us - - field.field.node.office.field_administration - - field.field.node.office.field_body - - field.field.node.office.field_description - - field.field.node.office.field_email_updates_link - - field.field.node.office.field_external_link - - field.field.node.office.field_last_saved_by_an_editor - - field.field.node.office.field_meta_tags - - field.field.node.office.field_office_id - - field.field.node.office.field_parent_office - - field.field.node.office.field_social_media_links - - node.type.office - module: - - field_group - - layout_builder - - user -third_party_settings: - field_group: - group_meta: - children: - - field_meta_tags - - field_meta_title - label: 'Meta tags' - parent_name: '' - region: hidden - weight: 14 - format_type: fieldset - format_settings: - classes: '' - id: '' - description: '' - layout_builder: - enabled: false - allow_custom: false -id: node.office.connect_with_us -targetEntityType: node -bundle: office -mode: connect_with_us -content: - flag_email_node: - settings: { } - third_party_settings: { } - weight: 10 - region: content - flag_subscribe_node: - settings: { } - third_party_settings: { } - weight: 10 - region: content -hidden: - breadcrumbs: true - content_moderation_control: true - field_administration: true - field_body: true - field_description: true - field_email_updates_link: true - field_external_link: true - field_last_saved_by_an_editor: true - field_meta_tags: true - field_office_id: true - field_parent_office: true - field_social_media_links: true - langcode: true - links: true - search_api_excerpt: true diff --git a/config/sync/core.entity_view_display.node.office.default.yml b/config/sync/core.entity_view_display.node.office.default.yml index faa1588219..9fb0e31915 100644 --- a/config/sync/core.entity_view_display.node.office.default.yml +++ b/config/sync/core.entity_view_display.node.office.default.yml @@ -6,13 +6,10 @@ dependencies: - field.field.node.office.field_administration - field.field.node.office.field_body - field.field.node.office.field_description - - field.field.node.office.field_email_updates_link - - field.field.node.office.field_external_link - field.field.node.office.field_last_saved_by_an_editor - field.field.node.office.field_meta_tags - field.field.node.office.field_office_id - field.field.node.office.field_parent_office - - field.field.node.office.field_social_media_links - node.type.office module: - field_group @@ -22,7 +19,6 @@ third_party_settings: field_group: group_meta: children: - - field_meta_title - field_meta_tags label: 'Meta tags' parent_name: '' @@ -84,10 +80,7 @@ hidden: content_moderation_control: true field_administration: true field_body: true - field_email_updates_link: true - field_external_link: true field_last_saved_by_an_editor: true - field_social_media_links: true langcode: true links: true search_api_excerpt: true diff --git a/config/sync/core.entity_view_display.node.office.teaser.yml b/config/sync/core.entity_view_display.node.office.teaser.yml index 9a13059e5a..2c97d9f885 100644 --- a/config/sync/core.entity_view_display.node.office.teaser.yml +++ b/config/sync/core.entity_view_display.node.office.teaser.yml @@ -7,13 +7,10 @@ dependencies: - field.field.node.office.field_administration - field.field.node.office.field_body - field.field.node.office.field_description - - field.field.node.office.field_email_updates_link - - field.field.node.office.field_external_link - field.field.node.office.field_last_saved_by_an_editor - field.field.node.office.field_meta_tags - field.field.node.office.field_office_id - field.field.node.office.field_parent_office - - field.field.node.office.field_social_media_links - node.type.office module: - user @@ -43,12 +40,9 @@ hidden: field_administration: true field_body: true field_description: true - field_email_updates_link: true - field_external_link: true field_last_saved_by_an_editor: true field_meta_tags: true field_office_id: true field_parent_office: true - field_social_media_links: true langcode: true search_api_excerpt: true diff --git a/config/sync/core.entity_view_mode.node.connect_with_us.yml b/config/sync/core.entity_view_mode.node.connect_with_us.yml deleted file mode 100644 index 270c03c706..0000000000 --- a/config/sync/core.entity_view_mode.node.connect_with_us.yml +++ /dev/null @@ -1,11 +0,0 @@ -uuid: 3775f15e-cd5c-41ac-af8d-babf0d5f13ad -langcode: en -status: true -dependencies: - module: - - node -id: node.connect_with_us -label: 'Connect with Us' -description: '' -targetEntityType: node -cache: true diff --git a/config/sync/field.field.node.campaign_landing_page.field_related_office.yml b/config/sync/field.field.node.campaign_landing_page.field_related_office.yml deleted file mode 100644 index ca88360c5e..0000000000 --- a/config/sync/field.field.node.campaign_landing_page.field_related_office.yml +++ /dev/null @@ -1,32 +0,0 @@ -uuid: 12e2495e-fc10-475c-a094-ada5be847203 -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_related_office - - node.type.campaign_landing_page - module: - - entity_reference_validators -third_party_settings: - entity_reference_validators: - circular_reference: false - circular_reference_deep: false - duplicate_reference: false -id: node.campaign_landing_page.field_related_office -field_name: field_related_office -entity_type: node -bundle: campaign_landing_page -label: 'Add a "Connect with us" panel' -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: - handler: views - handler_settings: - view: - view_name: content_entity_reference_source - display_name: entity_reference_7 - arguments: { } -field_type: entity_reference diff --git a/config/sync/field.field.node.landing_page.field_related_office.yml b/config/sync/field.field.node.landing_page.field_related_office.yml deleted file mode 100644 index fa041f0aaf..0000000000 --- a/config/sync/field.field.node.landing_page.field_related_office.yml +++ /dev/null @@ -1,32 +0,0 @@ -uuid: 8391b87b-9cd5-4d37-a3ec-556f33a98b1f -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_related_office - - node.type.landing_page - module: - - entity_reference_validators -third_party_settings: - entity_reference_validators: - circular_reference: false - circular_reference_deep: false - duplicate_reference: false -id: node.landing_page.field_related_office -field_name: field_related_office -entity_type: node -bundle: landing_page -label: 'Add a "Connect with us" block' -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: - handler: views - handler_settings: - view: - view_name: content_entity_reference_source - display_name: entity_reference_7 - arguments: { } -field_type: entity_reference diff --git a/config/sync/field.field.node.office.field_email_updates_link.yml b/config/sync/field.field.node.office.field_email_updates_link.yml deleted file mode 100644 index 53fab6d3b1..0000000000 --- a/config/sync/field.field.node.office.field_email_updates_link.yml +++ /dev/null @@ -1,23 +0,0 @@ -uuid: 71bc5e8e-2cc8-41e9-a4a1-4e229d12ea41 -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_email_updates_link - - node.type.office - module: - - link -id: node.office.field_email_updates_link -field_name: field_email_updates_link -entity_type: node -bundle: office -label: 'Email updates link' -description: 'Your link should begin with "https://public.govdelivery.com/accounts/"... and your link text should be in the format of "{{ENTER YOUR OFFICE}} email updates".' -required: false -translatable: true -default_value: { } -default_value_callback: '' -settings: - title: 2 - link_type: 16 -field_type: link diff --git a/config/sync/field.field.node.office.field_external_link.yml b/config/sync/field.field.node.office.field_external_link.yml deleted file mode 100644 index 31dbb55a88..0000000000 --- a/config/sync/field.field.node.office.field_external_link.yml +++ /dev/null @@ -1,23 +0,0 @@ -uuid: 361f5e78-e037-4d76-a417-8ee386b302bc -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_external_link - - node.type.office - module: - - link -id: node.office.field_external_link -field_name: field_external_link -entity_type: node -bundle: office -label: 'External link' -description: 'Enter a link to the office homepage on legacy va.gov or another external site.' -required: false -translatable: true -default_value: { } -default_value_callback: '' -settings: - title: 2 - link_type: 17 -field_type: link diff --git a/config/sync/field.field.node.office.field_social_media_links.yml b/config/sync/field.field.node.office.field_social_media_links.yml deleted file mode 100644 index 2f0d1b2f3c..0000000000 --- a/config/sync/field.field.node.office.field_social_media_links.yml +++ /dev/null @@ -1,171 +0,0 @@ -uuid: 1dd8d23f-ec01-4196-aac9-888096bd502b -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_social_media_links - - node.type.office - module: - - social_media_links_field -id: node.office.field_social_media_links -field_name: field_social_media_links -entity_type: node -bundle: office -label: 'Social media links' -description: '' -required: false -translatable: true -default_value: - - - platform: null - value: null - platform_values: - bitbucket: - value: '' - tumblr: - value: '' - googleplus: - value: '' - linkedin: - value: '' - rss: - value: '' - xing: - value: '' - vkontakte: - value: '' - contact: - value: '' - instagram: - value: '' - behance: - value: '' - github: - value: '' - youtube: - value: '' - pinterest: - value: '' - vimeo: - value: '' - facebook: - value: '' - drupal: - value: '' - email: - value: '' - twitter: - value: '' - website: - value: '' - gitlab: - value: '' - whatsapp: - value: '' - slideshare: - value: '' - youtube_channel: - value: '' - flickr: - value: '' -default_value_callback: '' -settings: - iconset: 'fontawesome:2x' - platforms: - bitbucket: - description: '' - weight: '-10' - enabled: 0 - pinterest: - description: '' - weight: '-9' - enabled: 0 - youtube_channel: - description: '' - weight: '-8' - enabled: 0 - slideshare: - description: '' - weight: '-7' - enabled: 0 - whatsapp: - description: '' - weight: '-6' - enabled: 0 - gitlab: - description: '' - weight: '-5' - enabled: 0 - website: - description: '' - weight: '-4' - enabled: 0 - twitter: - enabled: '1' - description: '' - weight: '-3' - email: - description: '' - weight: '-2' - enabled: 0 - drupal: - description: '' - weight: '-1' - enabled: 0 - facebook: - enabled: '1' - description: '' - weight: '0' - vimeo: - description: '' - weight: '1' - enabled: 0 - youtube: - enabled: '1' - description: '' - weight: '2' - tumblr: - description: '' - weight: '3' - enabled: 0 - github: - description: '' - weight: '4' - enabled: 0 - behance: - description: '' - weight: '5' - enabled: 0 - instagram: - enabled: '1' - description: '' - weight: '6' - contact: - description: '' - weight: '7' - enabled: 0 - vkontakte: - description: '' - weight: '8' - enabled: 0 - xing: - description: '' - weight: '9' - enabled: 0 - rss: - description: '' - weight: '10' - enabled: 0 - linkedin: - enabled: '1' - description: '' - weight: '11' - googleplus: - description: '' - weight: '12' - enabled: 0 - flickr: - description: '' - weight: '13' - enabled: 0 -field_type: social_media_links_field diff --git a/config/sync/field.storage.node.field_email_updates_link.yml b/config/sync/field.storage.node.field_email_updates_link.yml deleted file mode 100644 index 6a72174915..0000000000 --- a/config/sync/field.storage.node.field_email_updates_link.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: 81a8a283-7418-47fa-a7dd-1e34950969ad -langcode: en -status: true -dependencies: - module: - - link - - node -id: node.field_email_updates_link -field_name: field_email_updates_link -entity_type: node -type: link -settings: { } -module: link -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/config/sync/field.storage.node.field_external_link.yml b/config/sync/field.storage.node.field_external_link.yml deleted file mode 100644 index 4860e651aa..0000000000 --- a/config/sync/field.storage.node.field_external_link.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: fd60fda2-2f9a-401d-9ae1-5737489dc606 -langcode: en -status: true -dependencies: - module: - - link - - node -id: node.field_external_link -field_name: field_external_link -entity_type: node -type: link -settings: { } -module: link -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/config/sync/field.storage.node.field_related_office.yml b/config/sync/field.storage.node.field_related_office.yml deleted file mode 100644 index 411adc2a82..0000000000 --- a/config/sync/field.storage.node.field_related_office.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: dde4984e-2fe1-4cef-9402-b3d358d87c76 -langcode: en -status: true -dependencies: - module: - - node -id: node.field_related_office -field_name: field_related_office -entity_type: node -type: entity_reference -settings: - target_type: node -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/config/sync/field.storage.node.field_social_media_links.yml b/config/sync/field.storage.node.field_social_media_links.yml deleted file mode 100644 index 05b61fcdb6..0000000000 --- a/config/sync/field.storage.node.field_social_media_links.yml +++ /dev/null @@ -1,19 +0,0 @@ -uuid: c0f7cf47-7979-461a-a2f2-2bd1f7d2b3e1 -langcode: en -status: true -dependencies: - module: - - node - - social_media_links_field -id: node.field_social_media_links -field_name: field_social_media_links -entity_type: node -type: social_media_links_field -settings: { } -module: social_media_links_field -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/config/sync/views.view.content_entity_reference_source.yml b/config/sync/views.view.content_entity_reference_source.yml index 3e017c145f..53b38385ac 100644 --- a/config/sync/views.view.content_entity_reference_source.yml +++ b/config/sync/views.view.content_entity_reference_source.yml @@ -1189,214 +1189,3 @@ display: tags: - 'config:field.storage.node.field_administration' - 'config:workflow_list' - entity_reference_7: - id: entity_reference_7 - display_title: 'Entity Reference: Main Offices' - display_plugin: entity_reference - position: 2 - display_options: - fields: - title: - id: title - table: node_field_data - field: title - relationship: none - group_type: group - admin_label: '' - entity_type: node - entity_field: title - plugin_id: field - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: string - settings: - link_to_entity: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - pager: - type: some - options: - offset: 0 - items_per_page: 0 - sorts: - title_1: - id: title_1 - table: node_field_data - field: title - relationship: none - group_type: group - admin_label: '' - entity_type: node - entity_field: title - plugin_id: standard - order: ASC - expose: - label: '' - field_identifier: title_1 - exposed: false - arguments: - nid: - id: nid - table: node_field_data - field: nid - relationship: none - group_type: group - admin_label: '' - entity_type: node - entity_field: nid - plugin_id: node_nid - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: fixed - default_argument_options: - argument: 38442+38441+38440+38439 - summary_options: - base_path: '' - count: true - override: false - items_per_page: 25 - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: false - validate: - type: none - fail: 'not found' - validate_options: { } - break_phrase: true - not: false - filters: - type: - id: type - table: node_field_data - field: type - relationship: none - group_type: group - admin_label: '' - entity_type: node - entity_field: type - plugin_id: bundle - operator: in - value: - office: office - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - argument: null - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - filter_groups: - operator: AND - groups: - 1: AND - style: - type: entity_reference - options: - search_fields: - title: title - row: - type: entity_reference - options: - default_field_elements: true - inline: - title_1: title_1 - title: title - separator: ': ' - hide_empty: false - defaults: - relationships: false - fields: false - sorts: false - arguments: false - filters: false - filter_groups: false - relationships: { } - display_description: '' - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: { } diff --git a/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder.css b/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder.css index 7c73c407f7..4cb8a821c1 100644 --- a/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder.css +++ b/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder.css @@ -6,6 +6,18 @@ font-family: var(--font-family-serif); } +/* links */ +.form-builder-page-container a { + text-decoration: underline; +} + +.form-builder-page-container a:focus, +.form-builder-page-container a:hover { + background-color: rgba(0, 0, 0, 0.05); + color: var(--vads-color-base); + text-decoration: underline; +} + /* headings */ .form-builder-page-container h1 { font-size: var(--vads-font-size-heading-level-1); @@ -56,3 +68,30 @@ line-height: var(--units-3); padding: var(--units-1p5); } + +/* buttons */ +.form-builder-button, +a.form-builder-button { + border-radius: var(--units-0p5); + cursor: pointer; + font-weight: var(--font-weight-bold); + padding: var(--units-1p5) var(--units-2p5); + text-decoration: none; + transition: none; +} + +.form-builder-button--primary, +.form-builder-button--primary:focus, +a.form-builder-button--primary, +a.form-builder-button--primary:focus { + background: var(--vads-color-primary); + color: var(--vads-button-color-text-primary-on-light); + text-decoration: none; +} + +.form-builder-button--primary:hover, +a.form-builder-button--primary:hover { + background: var(--vads-color-primary-dark); + color: var(--vads-button-color-text-primary-on-light); + text-decoration: none; +} diff --git a/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder__home.css b/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder__home.css new file mode 100644 index 0000000000..903acfd19b --- /dev/null +++ b/docroot/modules/custom/va_gov_form_builder/css/va_gov_form_builder__home.css @@ -0,0 +1,30 @@ +/* Headings */ +.form-builder-page-content--home .form-builder-content-section__heading { + font-size: var(--vads-font-size-heading-level-4); +} + +/* New form */ +.form-builder-content-section--new-form__subheading { + margin-bottom: var(--units-3); +} + +/* Recent Forms */ +.form-builder-content-section--recent-forms { + margin-top: 60px; +} + +.form-builder-content-section--recent-forms__forms-list { + border-top: var(--units-1px) solid var(--vads-color-base-light); + list-style-type: none; + margin: 0; + padding-bottom: var(--units-3); + padding-top: var(--units-1p5); +} + +.form-builder-content-section--recent-forms__form-list-item { + margin-bottom: var(--units-1p5); +} + +.form-builder-content-section--recent-forms__form-link { + font-weight: var(--font-weight-bold); +} 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 58709040ae..2ea5b9ff8a 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 @@ -3,6 +3,7 @@ namespace Drupal\va_gov_form_builder\Controller; use Drupal\Core\Controller\ControllerBase; +use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -24,6 +25,16 @@ */ class VaGovFormBuilderController extends ControllerBase { + /** + * The prefix for the page-content theme definitions. + */ + const PAGE_CONTENT_THEME_PREFIX = 'page_content__va_gov_form_builder__'; + + /** + * The prefix for the page-specific style libraries. + */ + const LIBRARY_PREFIX = 'va_gov_form_builder/va_gov_form_builder_styles__'; + /** * The Drupal form builder. * @@ -32,11 +43,11 @@ class VaGovFormBuilderController extends ControllerBase { private $drupalFormBuilder; /** - * The page subtitle. + * The Digital Forms service. * - * @var string + * @var \Drupal\va_gov_form_builder\Service\DigitalFormsService */ - private $subtitle; + private $digitalFormsService; /** * {@inheritdoc} @@ -44,28 +55,29 @@ class VaGovFormBuilderController extends ControllerBase { public static function create(ContainerInterface $container) { $instance = parent::create($container); $instance->drupalFormBuilder = $container->get('form_builder'); + $instance->digitalFormsService = $container->get('va_gov_form_builder.digital_forms_service'); return $instance; } /** - * Returns a render array representing the page with the passed-in form. + * Returns a render array representing the page with the passed-in content. * - * @param string $formName - * The filename of the form to be rendered. - * @param string $nid - * The node id, passed in when the form in question edits an existing node. + * @param array $pageContent + * A render array representing the page content. + * @param string $subtitle + * The subtitle for the page. + * @param string $libraries + * Libraries for the page, in addition to the Form Builder general library, + * which is added automatically. */ - private function getFormPage($formName, $nid = NULL) { - // @phpstan-ignore-next-line - $form = $this->drupalFormBuilder->getForm('Drupal\va_gov_form_builder\Form\\' . $formName, $nid); - - return [ + private function getPage($pageContent, $subtitle, $libraries = NULL) { + $page = [ '#type' => 'page', - 'content' => $form, + 'content' => $pageContent, // Add custom data. 'form_builder_page_data' => [ - 'subtitle' => $this->subtitle, + 'subtitle' => $subtitle, ], // Add styles. '#attached' => [ @@ -74,37 +86,86 @@ private function getFormPage($formName, $nid = NULL) { ], ], ]; + + if (!empty($libraries)) { + foreach ($libraries as $library) { + $page['#attached']['library'][] = self::LIBRARY_PREFIX . $library; + } + } + + return $page; } /** - * Entry point for the VA Form Builder. Redirects to the intro page. + * Returns a render array representing the page with the passed-in form. + * + * @param string $formName + * The filename of the form to be rendered. + * @param string $subtitle + * The subtitle for the page. + * @param string $libraries + * Libraries for the page, in addition to the Form Builder general library, + * which is added automatically. + * @param string $nid + * The node id, passed in when the form in question edits an existing node. + */ + private function getFormPage($formName, $subtitle, $libraries = NULL, $nid = NULL) { + // @phpstan-ignore-next-line + $form = $this->drupalFormBuilder->getForm('Drupal\va_gov_form_builder\Form\\' . $formName, $nid); + + return $this->getPage($form, $subtitle, $libraries); + } + + /** + * Entry point for the VA Form Builder. Redirects to the home page. */ public function entry() { - return $this->redirect('va_gov_form_builder.intro'); + return $this->redirect('va_gov_form_builder.home'); } /** - * Intro page. + * Home page. */ - public function intro() { - $this->subtitle = 'Subtitle Placeholder'; - return $this->getFormPage('Intro'); + public function home() { + // Passing "FALSE" to fetch draft nodes rather than only published nodes. + $digitalForms = $this->digitalFormsService->getDigitalForms(FALSE); + + $recentForms = []; + foreach ($digitalForms as $digitalForm) { + $recentForms[] = [ + 'nid' => $digitalForm->id(), + 'title' => $digitalForm->getTitle(), + 'formNumber' => $digitalForm->get('field_va_form_number')->value, + ]; + } + + $pageContent = [ + '#theme' => self::PAGE_CONTENT_THEME_PREFIX . 'home', + '#build_form_url' => Url::fromRoute('va_gov_form_builder.start_conversion')->toString(), + '#recent_forms' => $recentForms, + ]; + $subtitle = 'Select a form'; + $libraries = ['home']; + + return $this->getPage($pageContent, $subtitle, $libraries); } /** * Start-conversion page. */ public function startConversion() { - $this->subtitle = 'Subtitle Placeholder'; - return $this->getFormPage('StartConversion'); + $formName = 'StartConversion'; + $subtitle = 'Subtitle Placeholder'; + return $this->getFormPage($formName, $subtitle); } /** * Name-and-date-of-birth page. */ public function nameAndDob($nid) { - $this->subtitle = 'Subtitle Placeholder'; - return $this->getFormPage('NameAndDob', $nid); + $formName = 'NameAndDob'; + $subtitle = 'Subtitle Placeholder'; + return $this->getFormPage($formName, $subtitle, NULL, $nid); } } diff --git a/docroot/modules/custom/va_gov_form_builder/src/Form/Intro.php b/docroot/modules/custom/va_gov_form_builder/src/Form/Intro.php deleted file mode 100644 index 6ee3bc7f04..0000000000 --- a/docroot/modules/custom/va_gov_form_builder/src/Form/Intro.php +++ /dev/null @@ -1,103 +0,0 @@ - 'html_tag', - '#tag' => 'h2', - '#children' => $this->t('Working with the Form Builder'), - ]; - - $form['paragraph_1'] = [ - '#type' => 'html_tag', - '#tag' => 'p', - '#children' => $this->t('This is where the conversion of an existing form, or the continued editing - of a converted form, takes place.'), - ]; - - $form['before_beginning_header'] = [ - '#type' => 'html_tag', - '#tag' => 'h3', - '#children' => $this->t('Before beginning'), - ]; - - $form['paragraph_2'] = [ - '#type' => 'html_tag', - '#tag' => 'p', - '#children' => $this->t('Make sure you have a copy of the form you are intending to convert. - This will make it easier to reference the information - that will be needed, and the order in which it appears for your users.'), - ]; - - $form['paragraph_3'] = [ - '#type' => 'html_tag', - '#tag' => 'p', - '#children' => $this->t('When returning to update an existing conversion, your past projects - are listed under Projects at right.'), - ]; - - $form['paragraph_4'] = [ - '#type' => 'html_tag', - '#tag' => 'p', - '#children' => $this->t('If you need to access a conversion that you did not create, you can use the - content search to find that project.'), - ]; - - $form['paragraph_5'] = [ - '#type' => 'html_tag', - '#tag' => 'p', - '#children' => $this->t('To begin a new project select Start conversion.'), - ]; - - $form['actions']['start_conversion'] = [ - '#type' => 'submit', - '#value' => $this->t('Start conversion'), - '#attributes' => [ - 'class' => [ - 'button', - 'button--primary', - 'js-form-submit', - 'form-submit', - ], - ], - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $form_state->setRedirect('va_gov_form_builder.start_conversion'); - } - -} diff --git a/docroot/modules/custom/va_gov_form_builder/src/Form/StartConversion.php b/docroot/modules/custom/va_gov_form_builder/src/Form/StartConversion.php index 51f6376f50..1c4ba0c1d4 100644 --- a/docroot/modules/custom/va_gov_form_builder/src/Form/StartConversion.php +++ b/docroot/modules/custom/va_gov_form_builder/src/Form/StartConversion.php @@ -133,7 +133,7 @@ protected function setDigitalFormNodeFromFormState(array &$form, FormStateInterf * Submit handler for the 'Back' button. */ public function backButtonSubmitHandler(array &$form, FormStateInterface $form_state) { - $form_state->setRedirect('va_gov_form_builder.intro'); + $form_state->setRedirect('va_gov_form_builder.home'); } /** diff --git a/docroot/modules/custom/va_gov_form_builder/src/Service/DigitalFormsService.php b/docroot/modules/custom/va_gov_form_builder/src/Service/DigitalFormsService.php new file mode 100644 index 0000000000..3b9a8ab4a6 --- /dev/null +++ b/docroot/modules/custom/va_gov_form_builder/src/Service/DigitalFormsService.php @@ -0,0 +1,54 @@ +entityTypeManager = $entityTypeManager; + } + + /** + * Retrieves all Digital Form nodes. + * + * @param bool $publishedOnly + * Whether to retrieve only published nodes. + * + * @return \Drupal\node\NodeInterface[] + * An array of node objects of type 'digital_form'. + */ + public function getDigitalForms($publishedOnly = TRUE) { + $query = $this->entityTypeManager->getStorage('node')->getQuery() + ->accessCheck(FALSE) + ->condition('type', 'digital_form'); + + if ($publishedOnly) { + $query->condition('status', 1); + } + + $nids = $query->execute(); + + if (!empty($nids)) { + return $this->entityTypeManager->getStorage('node')->loadMultiple($nids); + } + return []; + } + +} 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/page-content--va-gov-form-builder--home.html.twig new file mode 100644 index 0000000000..83702f0936 --- /dev/null +++ b/docroot/modules/custom/va_gov_form_builder/templates/page-content/page-content--va-gov-form-builder--home.html.twig @@ -0,0 +1,37 @@ +
+

Start a new form, or select a previous form to work with

+ +
+

Start a new form

+

+ Build a new form in Form Builder by selecting Build a form +

+ + Build a form + +
+ +
+

Recent forms

+

Select a recent form to edit

+ +
+ + +
diff --git a/docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig b/docroot/modules/custom/va_gov_form_builder/templates/page/page--va-gov-form-builder.html.twig similarity index 100% rename from docroot/modules/custom/va_gov_form_builder/templates/page--va-gov-form-builder.html.twig rename to docroot/modules/custom/va_gov_form_builder/templates/page/page--va-gov-form-builder.html.twig 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 4c70ae555e..691f830b8f 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 @@ -5,3 +5,8 @@ va_gov_form_builder_styles: css/va_gov_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: + version: 1.x + css: + theme: + css/va_gov_form_builder__home.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 69e564509f..cd4fce3e7f 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 @@ -21,13 +21,29 @@ function va_gov_form_builder_entity_bundle_field_info_alter(&$fields, EntityType /** * Implements hook_theme(). */ -function va_gov_form_builder_theme() { - return [ - 'page__va_gov_form_builder' => [ - 'base hook' => 'page', - 'path' => \Drupal::service('extension.list.module')->getPath('va_gov_form_builder') . '/templates', +function va_gov_form_builder_theme($_existing, $_type, $_theme, $path) { + $theme = []; + + // Add page-wrapper theme. + $theme['page__va_gov_form_builder'] = [ + 'base hook' => 'page', + 'path' => $path . '/templates/page', + ]; + + // Add page-content themes. + $page_content_theme_prefix = 'page_content__va_gov_form_builder__'; + $page_content_theme_path = $path . '/templates/page-content'; + + // 1. Home page + $theme[$page_content_theme_prefix . 'home'] = [ + 'path' => $page_content_theme_path, + 'variables' => [ + 'recent_forms' => [], + 'build_form_url' => '', ], ]; + + return $theme; } /** 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 52a9145505..1afecc33e9 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 @@ -2,10 +2,10 @@ va_gov_form_builder.entry: path: "/form-builder" defaults: _controller: '\Drupal\va_gov_form_builder\Controller\VaGovFormBuilderController::entry' -va_gov_form_builder.intro: - path: "/form-builder/intro" +va_gov_form_builder.home: + path: "/form-builder/home" defaults: - _controller: '\Drupal\va_gov_form_builder\Controller\VaGovFormBuilderController::intro' + _controller: '\Drupal\va_gov_form_builder\Controller\VaGovFormBuilderController::home' va_gov_form_builder.start_conversion: path: "/form-builder/start-conversion" defaults: diff --git a/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.services.yml b/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.services.yml index b6af461fe8..507dbd20a9 100644 --- a/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.services.yml +++ b/docroot/modules/custom/va_gov_form_builder/va_gov_form_builder.services.yml @@ -3,3 +3,6 @@ services: class: Drupal\va_gov_form_builder\Routing\RouteSubscriber tags: - { name: "event_subscriber" } + va_gov_form_builder.digital_forms_service: + class: Drupal\va_gov_form_builder\Service\DigitalFormsService + arguments: ["@entity_type.manager"] diff --git a/docroot/themes/custom/vagovclaro/templates/node/node--office--connect-with-us.html.twig b/docroot/themes/custom/vagovclaro/templates/node/node--office--connect-with-us.html.twig deleted file mode 100644 index 19fd5211db..0000000000 --- a/docroot/themes/custom/vagovclaro/templates/node/node--office--connect-with-us.html.twig +++ /dev/null @@ -1,97 +0,0 @@ -{# -/** - * @file - * Theme override to display a node. - * - * Available variables: - * - node: The node entity with limited access to object properties and methods. - * Only method names starting with "get", "has", or "is" and a few common - * methods such as "id", "label", and "bundle" are available. For example: - * - node.getCreatedTime() will return the node creation timestamp. - * - node.hasField('field_example') returns TRUE if the node bundle includes - * field_example. (This does not indicate the presence of a value in this - * field.) - * - node.isPublished() will return whether the node is published or not. - * Calling other methods, such as node.delete(), will result in an exception. - * See \Drupal\node\Entity\Node for a full list of public properties and - * methods for the node object. - * - label: (optional) The title of the node. - * - content: All node items. Use {{ content }} to print them all, - * or print a subset such as {{ content.field_example }}. Use - * {{ content|without('field_example') }} to temporarily suppress the printing - * of a given child element. - * - author_picture: The node author user entity, rendered using the "compact" - * view mode. - * - metadata: Metadata for this node. - * - date: (optional) Themed creation date field. - * - author_name: (optional) Themed author name field. - * - url: Direct URL of the current node. - * - display_submitted: Whether submission information should be displayed. - * - attributes: HTML attributes for the containing element. - * The attributes.class element may contain one or more of the following - * classes: - * - node: The current template type (also known as a "theming hook"). - * - node--type-[type]: The current node type. For example, if the node is an - * "Article" it would result in "node--type-article". Note that the machine - * name will often be in a short form of the human readable label. - * - node--view-mode-[view_mode]: The View Mode of the node; for example, a - * teaser would result in: "node--view-mode-teaser", and - * full: "node--view-mode-full". - * The following are controlled through the node publishing options. - * - node--promoted: Appears on nodes promoted to the front page. - * - node--sticky: Appears on nodes ordered above other non-sticky nodes in - * teaser listings. - * - node--unpublished: Appears on unpublished nodes visible only to site - * admins. - * NOTE: This is intentionally removed from this template so that - * the content that is visible on VA.gov whether it is published - * or not, does no confuse editors by appearing unpublished. - * - title_attributes: Same as attributes, except applied to the main title - * tag that appears in the template. - * - content_attributes: Same as attributes, except applied to the main - * content tag that appears in the template. - * - author_attributes: Same as attributes, except applied to the author of - * the node tag that appears in the template. - * - title_prefix: Additional output populated by modules, intended to be - * displayed in front of the main title tag that appears in the template. - * - title_suffix: Additional output populated by modules, intended to be - * displayed after the main title tag that appears in the template. - * - view_mode: View mode; for example, "teaser" or "full". - * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'. - * - page: Flag for the full page state. Will be true if view_mode is 'full'. - * - readmore: Flag for more state. Will be true if the teaser content of the - * node cannot hold the main body content. - * - logged_in: Flag for authenticated user status. Will be true when the - * current user is a logged-in member. - * - is_admin: Flag for admin user status. Will be true when the current user - * is an administrator. - * - * @see template_preprocess_node() - * - * @todo Remove the id attribute (or make it a class), because if that gets - * rendered twice on a page this is invalid CSS for example: two lists - * in different view modes. - */ -#} -{% - set classes = [ - 'node', - 'node--type-' ~ node.bundle|clean_class, - node.isPromoted() ? 'node--promoted', - node.isSticky() ? 'node--sticky', - view_mode ? 'node--view-mode-' ~ view_mode|clean_class, - ] -%} -{{ attach_library('claro/classy.node') }} - -

Connect with us

- {{content.field_external_link}} - {% if node.field_email_updates_link.0.url %} -

Get updates

- {{content.field_email_updates_link}} - {% endif %} - {% if node.field_social_media_links.0 %} -

Follow us

- {{content.field_social_media_links}} - {% endif %} - diff --git a/tests/phpunit/va_gov_form_builder/Traits/TestFormLoads.php b/tests/phpunit/va_gov_form_builder/Traits/TestPageLoads.php similarity index 69% rename from tests/phpunit/va_gov_form_builder/Traits/TestFormLoads.php rename to tests/phpunit/va_gov_form_builder/Traits/TestPageLoads.php index 506f523ad3..1cd9a681e5 100644 --- a/tests/phpunit/va_gov_form_builder/Traits/TestFormLoads.php +++ b/tests/phpunit/va_gov_form_builder/Traits/TestPageLoads.php @@ -3,9 +3,9 @@ namespace tests\phpunit\va_gov_form_builder\Traits; /** - * Provides a trait for testing that forms load and do not load appropriately. + * Provides a trait for testing that pages load and do not load appropriately. */ -trait TestFormLoads { +trait TestPageLoads { /** * Logs-in a user with appropriate privileges. @@ -17,14 +17,14 @@ private function loginFormBuilderUser() { } /** - * Test the form is accessible to a user with the correct privilege. + * Test the page is accessible to a user with the correct privilege. * * @param string $url - * The (form) page to load. + * The page to load. * @param string $expectedText * The text expected to show on the loaded page. */ - private function sharedTestFormLoads($url, $expectedText) { + private function sharedTestPageLoads($url, $expectedText) { // Log in a user with permission. $this->loginFormBuilderUser(); @@ -36,12 +36,12 @@ private function sharedTestFormLoads($url, $expectedText) { } /** - * Test the form is not accessible to a user without the correct privilege. + * Test the page is not accessible to a user without the correct privilege. * * @param string $url - * The (form) page to load. + * The page to load. */ - private function sharedTestFormDoesNotLoad($url) { + private function sharedTestPageDoesNotLoad($url) { // Log in a user without permission. $this->drupalLogin($this->createUser([])); 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 7c6bdae099..2eddf1cda5 100644 --- a/tests/phpunit/va_gov_form_builder/functional/Controller/VaGovFormBuilderControllerTest.php +++ b/tests/phpunit/va_gov_form_builder/functional/Controller/VaGovFormBuilderControllerTest.php @@ -4,6 +4,7 @@ use Drupal\Core\Url; use Drupal\va_gov_form_builder\Controller\VaGovFormBuilderController; +use Drupal\va_gov_form_builder\Service\DigitalFormsService; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\RedirectResponse; use Tests\Support\Classes\VaGovExistingSiteBase; @@ -37,7 +38,15 @@ public function setUp(): void { parent::setUp(); $container = new ContainerBuilder(); + + // Add Drupal's form builder to the service container. $container->set('form_builder', \Drupal::formBuilder()); + + // Add our DigitalFormsService to the service container. + $digitalFormsService = new DigitalFormsService(\Drupal::service('entity_type.manager')); + $container->set('va_gov_form_builder.digital_forms_service', $digitalFormsService); + + // Create the controller instance. $this->controller = VaGovFormBuilderController::create($container); } @@ -45,7 +54,7 @@ public function setUp(): void { * Tests css is included. */ public function testCssIncluded() { - $page = $this->controller->intro(); + $page = $this->controller->home(); $this->assertContains( 'va_gov_form_builder/va_gov_form_builder_styles', @@ -61,17 +70,21 @@ public function testEntryRedirect() { $response = $this->controller->entry(); $this->assertInstanceOf(RedirectResponse::class, $response); - $this->assertStringContainsString(Url::fromRoute('va_gov_form_builder.intro')->toString(), $response->getTargetUrl()); + $this->assertStringContainsString(Url::fromRoute('va_gov_form_builder.home')->toString(), $response->getTargetUrl()); } /** - * Tests the intro method returns an Intro form. + * Tests the home method returns a Home page. */ - public function testIntro() { - $page = $this->controller->intro(); + public function testHome() { + $page = $this->controller->home(); $this->assertArrayHasKey('content', $page); - $this->assertArrayHasKey('working_with_form_builder_header', $page['content']); + $this->assertArrayHasKey('#theme', $page['content']); + $this->assertEquals('page_content__va_gov_form_builder__home', $page['content']['#theme']); + + $this->assertArrayHasKey('#attached', $page); + $this->assertContains('va_gov_form_builder/va_gov_form_builder_styles__home', $page['#attached']['library']); } /** diff --git a/tests/phpunit/va_gov_form_builder/functional/Form/IntroTest.php b/tests/phpunit/va_gov_form_builder/functional/Form/IntroTest.php deleted file mode 100644 index 7c310d9aff..0000000000 --- a/tests/phpunit/va_gov_form_builder/functional/Form/IntroTest.php +++ /dev/null @@ -1,63 +0,0 @@ -loginFormBuilderUser(); - $this->drupalGet($this->getFormPageUrl()); - } - - /** - * Test that the form is accessible to a user with the correct privilege. - */ - public function testFormLoads() { - $this->sharedTestFormLoads($this->getFormPageUrl(), 'Working with the Form Builder'); - } - - /** - * Test that the form is not accessible to a user without privilege. - */ - public function testFormDoesNotLoad() { - $this->sharedTestFormDoesNotLoad($this->getFormPageUrl()); - } - - /** - * Test the 'Start conversion' button. - */ - public function testButton() { - $this->click('.button#edit-start-conversion'); - $this->assertSession()->addressEquals('/form-builder/start-conversion'); - } - -} diff --git a/tests/phpunit/va_gov_form_builder/functional/Form/NameAndDobTest.php b/tests/phpunit/va_gov_form_builder/functional/Form/NameAndDobTest.php index 06a3d883ab..5134c98326 100644 --- a/tests/phpunit/va_gov_form_builder/functional/Form/NameAndDobTest.php +++ b/tests/phpunit/va_gov_form_builder/functional/Form/NameAndDobTest.php @@ -4,7 +4,7 @@ use Drupal\node\Entity\Node; use tests\phpunit\va_gov_form_builder\Traits\SharedConstants; -use tests\phpunit\va_gov_form_builder\Traits\TestFormLoads; +use tests\phpunit\va_gov_form_builder\Traits\TestPageLoads; use Tests\Support\Classes\VaGovExistingSiteBase; /** @@ -18,7 +18,7 @@ class NameAndDobTest extends VaGovExistingSiteBase { use SharedConstants; - use TestFormLoads; + use TestPageLoads; /** * {@inheritdoc} @@ -65,17 +65,17 @@ public function setUp(): void { } /** - * Test that the form is accessible to a user with the correct privilege. + * Test that the page is accessible to a user with the correct privilege. */ - public function testFormLoads() { - $this->sharedTestFormLoads($this->getFormPageUrl(), 'Collecting Name and Date of birth'); + public function testPageLoads() { + $this->sharedTestPageLoads($this->getFormPageUrl(), 'Collecting Name and Date of birth'); } /** - * Test that the form is not accessible to a user without privilege. + * Test that the page is not accessible to a user without privilege. */ - public function testFormDoesNotLoad() { - $this->sharedTestFormDoesNotLoad($this->getFormPageUrl()); + public function testPageDoesNotLoad() { + $this->sharedTestPageDoesNotLoad($this->getFormPageUrl()); } /** diff --git a/tests/phpunit/va_gov_form_builder/functional/Form/StartConversionTest.php b/tests/phpunit/va_gov_form_builder/functional/Form/StartConversionTest.php index 597fa905fa..314ad6ea09 100644 --- a/tests/phpunit/va_gov_form_builder/functional/Form/StartConversionTest.php +++ b/tests/phpunit/va_gov_form_builder/functional/Form/StartConversionTest.php @@ -3,7 +3,7 @@ namespace tests\phpunit\va_gov_form_builder\functional\Form; use tests\phpunit\va_gov_form_builder\Traits\SharedConstants; -use tests\phpunit\va_gov_form_builder\Traits\TestFormLoads; +use tests\phpunit\va_gov_form_builder\Traits\TestPageLoads; use Tests\Support\Classes\VaGovExistingSiteBase; /** @@ -17,7 +17,7 @@ class StartConversionTest extends VaGovExistingSiteBase { use SharedConstants; - use TestFormLoads; + use TestPageLoads; /** * {@inheritdoc} @@ -42,17 +42,17 @@ public function setUp(): void { } /** - * Test that the form is accessible to a user with the correct privilege. + * Test that the page is accessible to a user with the correct privilege. */ - public function testFormLoads() { - $this->sharedTestFormLoads($this->getFormPageUrl(), 'Start a new conversion'); + public function testPageLoads() { + $this->sharedTestPageLoads($this->getFormPageUrl(), 'Start a new conversion'); } /** - * Test that the form is not accessible to a user without privilege. + * Test that the page is not accessible to a user without privilege. */ - public function testFormDoesNotLoad() { - $this->sharedTestFormDoesNotLoad($this->getFormPageUrl()); + public function testPageDoesNotLoad() { + $this->sharedTestPageDoesNotLoad($this->getFormPageUrl()); } /** @@ -95,11 +95,11 @@ public function testFormSubmissionFailsOnMissingRequiredField() { } /** - * Test the 'Back' button takes the user back to the Intro page. + * Test the 'Back' button takes the user back to the Home page. */ public function testBackButton() { $this->click('.button#edit-back'); - $this->assertSession()->addressEquals('/form-builder/intro'); + $this->assertSession()->addressEquals('/form-builder/home'); } } diff --git a/tests/phpunit/va_gov_form_builder/functional/content-pages/HomeTest.php b/tests/phpunit/va_gov_form_builder/functional/content-pages/HomeTest.php new file mode 100644 index 0000000000..5f00ef132a --- /dev/null +++ b/tests/phpunit/va_gov_form_builder/functional/content-pages/HomeTest.php @@ -0,0 +1,87 @@ +loginFormBuilderUser(); + } + + /** + * Test that the page is accessible to a user with the correct privilege. + */ + public function testPageLoads() { + $this->drupalGet($this->getPageUrl()); + $this->sharedTestPageLoads($this->getPageUrl(), 'Start a new form, or select a previous form to work with'); + } + + /** + * Test that the page is not accessible to a user without privilege. + */ + public function testPageDoesNotLoad() { + $this->drupalGet($this->getPageUrl()); + $this->sharedTestPageDoesNotLoad($this->getPageUrl()); + } + + /** + * Test the 'Build a form' button. + */ + public function testButton() { + $this->drupalGet($this->getPageUrl()); + $this->click('a#form-builder-build-form-button'); + $this->assertSession()->addressEquals('/form-builder/start-conversion'); + } + + /** + * Test the list of recent forms. + */ + public function testRecentFormsList() { + $title = 'Test Digital Form ' . uniqid(); + $formNumber = '99-9999'; + + // Create a new Digital Form node. + $this->createNode([ + 'type' => 'digital_form', + 'title' => $title, + 'field_chapters' => [], + 'field_va_form_number' => $formNumber, + ]); + + // Load page. + $this->drupalGet($this->getPageUrl()); + + // Ensure a link to the form appears on the page + // (in the list of recent forms). + // Ensure the link text is formatted as expected. + $this->assertSession()->linkExists($title . ' (VA Form ' . $formNumber . ')'); + } + +} diff --git a/tests/phpunit/va_gov_form_builder/functional/templates/FormBuilderPageTemplateTest.php b/tests/phpunit/va_gov_form_builder/functional/templates/FormBuilderPageTemplateTest.php index 44c2395318..47c26834b6 100644 --- a/tests/phpunit/va_gov_form_builder/functional/templates/FormBuilderPageTemplateTest.php +++ b/tests/phpunit/va_gov_form_builder/functional/templates/FormBuilderPageTemplateTest.php @@ -11,7 +11,7 @@ * that should result in rendering a page that utilizes the * page template under test. In this way, we can test the expected * behavior of the template file in a consistent manner, assuming - * the route properly utilizes the theme (which is tested elswhere). + * the route properly utilizes the theme (which is tested elsewhere). * * The route that makes the most sense here * is the `entry` route, as that should always be present, regardless diff --git a/tests/phpunit/va_gov_form_builder/unit/ModuleTest.php b/tests/phpunit/va_gov_form_builder/unit/ModuleTest.php index 07ad0b2858..c2c296cdcd 100644 --- a/tests/phpunit/va_gov_form_builder/unit/ModuleTest.php +++ b/tests/phpunit/va_gov_form_builder/unit/ModuleTest.php @@ -3,7 +3,6 @@ namespace tests\phpunit\va_gov_form_builder\unit; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Extension\ModuleExtensionList; use Drupal\Core\Routing\RouteMatchInterface; use DrupalFinder\DrupalFinder; use Tests\Support\Classes\VaGovUnitTestBase; @@ -57,21 +56,29 @@ protected function setUp(): void { * @covers ::va_gov_form_builder_theme */ public function testVaGovFormBuilderHookTheme() { - // Mock the extension.list.module service and add to the container. - $extensionListMock = $this->createMock(ModuleExtensionList::class); - $extensionListMock->expects($this->once()) - ->method('getPath') - ->with('va_gov_form_builder') - ->willReturn($this->modulePath); - $this->container->set('extension.list.module', $extensionListMock); - // Call the function to test. - $result = va_gov_form_builder_theme(); + $result = va_gov_form_builder_theme( + NULL, + NULL, + NULL, + $this->modulePath + ); // 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', $result['page__va_gov_form_builder']['path']); + $this->assertEquals($this->modulePath . '/templates/page', $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'; + // Home page. + $this->assertArrayHasKey($page_content_theme_prefix . 'home', $result); + $this->assertEquals($page_content_theme_path, $result[$page_content_theme_prefix . 'home']['path']); + $this->assertArrayHasKey('variables', $result[$page_content_theme_prefix . 'home']); + $this->assertArrayHasKey('recent_forms', $result[$page_content_theme_prefix . 'home']['variables']); + $this->assertArrayHasKey('build_form_url', $result[$page_content_theme_prefix . 'home']['variables']); } /** diff --git a/tests/phpunit/va_gov_form_builder/unit/Service/DigitalFormsServiceTest.php b/tests/phpunit/va_gov_form_builder/unit/Service/DigitalFormsServiceTest.php new file mode 100644 index 0000000000..ed937587c9 --- /dev/null +++ b/tests/phpunit/va_gov_form_builder/unit/Service/DigitalFormsServiceTest.php @@ -0,0 +1,195 @@ +entityTypeManager = $this->createMock(EntityTypeManagerInterface::class); + + // Instantiate the service with the mocked dependencies. + $this->digitalFormsService = new DigitalFormsService($this->entityTypeManager); + } + + /** + * Helper function to DRY up expectation setup. + */ + private function setUpMockQuery($publishedOnly, $hasResults = TRUE) { + // Mock the entity storage. + $entityStorage = $this->createMock(EntityStorageInterface::class); + + // Mock the query and return node IDs. + $query = $this->createMock(QueryInterface::class); + + $query->method('accessCheck') + ->willReturnSelf(); + + if ($publishedOnly) { + $query->expects($this->exactly(2)) + ->method('condition') + ->withConsecutive( + ['type', 'digital_form'], + ['status', 1], + ) + ->willReturnSelf(); + } + else { + $query->expects($this->once()) + ->method('condition') + ->withConsecutive( + ['type', 'digital_form'], + ) + ->willReturnSelf(); + } + + if ($hasResults) { + $query->expects($this->once()) + ->method('execute') + ->willReturn([1, 2]); + } + else { + $query->expects($this->once()) + ->method('execute') + ->willReturn(NULL); + } + + // Mock the entity storage to return the query and nodes. + $entityStorage->expects($this->once()) + ->method('getQuery') + ->willReturn($query); + + if ($hasResults) { + $entityStorage->expects($this->once()) + ->method('loadMultiple') + ->with([1, 2]) + ->willReturn([ + 1 => $this->createMock('Drupal\node\NodeInterface'), + 2 => $this->createMock('Drupal\node\NodeInterface'), + ]); + } + + // Mock the entity type manager. + if ($hasResults) { + $this->entityTypeManager->expects($this->exactly(2)) + ->method('getStorage') + ->with('node') + ->willReturn($entityStorage); + } + else { + $this->entityTypeManager->expects($this->once()) + ->method('getStorage') + ->with('node') + ->willReturn($entityStorage); + } + } + + /** + * Tests getDigitalForms() when $publishedOnly is TRUE. + * + * Query should include `status` condition. + * + * @covers ::getDigitalForms + */ + public function testGetDigitalFormsPublishedOnlyTrue() { + // We will call the method with $publishedOnly = TRUE, + // so we set up expectations accordingly. + $this->setUpMockQuery(TRUE); + + // Call the method, which asserts expectations set in setup. + $this->digitalFormsService->getDigitalForms(TRUE); + } + + /** + * Tests getDigitalForms() when $publishedOnly is FALSE. + * + * Query should not include `status` condition. + * + * @covers ::getDigitalForms + */ + public function testGetDigitalFormsPublishedOnlyFalse() { + // We will call the method with $publishedOnly = FALSE, + // so we set up expectations accordingly. + $this->setUpMockQuery(FALSE); + + // Call the method, which asserts expectations set in setup. + $this->digitalFormsService->getDigitalForms(FALSE); + } + + /** + * Tests getDigitalForms() defaults to $publishedOnly TRUE. + * + * @covers ::getDigitalForms + */ + public function testGetDigitalFormsPublishedOnlyDefault() { + // We will call the method without passing $publishedOnly, + // and we want to ensure that the expectations are set up + // as though the value were set to TRUE, which is the + // expected default. + $this->setUpMockQuery(TRUE); + + // Call the method, which asserts expectations set in setup. + $this->digitalFormsService->getDigitalForms(); + } + + /** + * Tests getDigitalForms() returns empty array if no results. + * + * @covers ::getDigitalForms + */ + public function testGetDigitalFormsNoResults() { + // We set up the query to return no results + // by passing FALSE as second parameter. + // + // In the setup helper, this sets up expectations accordingly: + // 1. That + // `$this->entityTypeManager->getStorage('node')->loadMultiple($nids)` + // will not be called, since no node ids will be returned from + // the initial fetch. + // + // 2. That `$this->entityTypeManager->getStorage('node')` + // will be called only once, rather than twice, + // since there will be no need to call `loadMultiple`. + $this->setUpMockQuery(TRUE, FALSE); + + // Call the method, which asserts expectations set in setup. + $result = $this->digitalFormsService->getDigitalForms(TRUE); + + // Additionally, assert the function returns no results. + $this->assertCount(0, $result); + } + +}