Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USAGOV-1899 Benefits Redirect Modal #1896

Merged
merged 11 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/sync/block_content.type.modal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
uuid: 1299811c-9a61-493c-b6d3-dea4dc45c4f4
langcode: en
status: true
dependencies: { }
id: modal
label: Modal
revision: 0
description: ''
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
uuid: ae5cfc79-6a21-4a6a-acc5-1515022629eb
langcode: en
status: true
dependencies:
config:
- block_content.type.modal
- field.field.block_content.modal.field_modal
- field.field.block_content.modal.field_modal_id
module:
- paragraphs
id: block_content.modal.default
targetEntityType: block_content
bundle: modal
mode: default
content:
field_modal:
type: paragraphs
weight: 2
region: content
settings:
title: Paragraph
title_plural: Paragraphs
edit_mode: open
closed_mode: summary
autocollapse: none
closed_mode_threshold: 0
add_mode: dropdown
form_display_mode: default
default_paragraph_type: ''
features:
collapse_edit_all: collapse_edit_all
duplicate: duplicate
third_party_settings: { }
field_modal_id:
type: string_textfield
weight: 1
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
info:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
langcode:
type: language_select
weight: 3
region: content
settings:
include_locked: true
third_party_settings: { }
hidden: { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
uuid: 94f199f4-097b-4581-bb7e-8b1149afb7ba
langcode: en
status: true
dependencies:
config:
- block_content.type.modal
- field.field.block_content.modal.field_modal
- field.field.block_content.modal.field_modal_id
module:
- entity_reference_revisions
id: block_content.modal.default
targetEntityType: block_content
bundle: modal
mode: default
content:
field_modal:
type: entity_reference_revisions_entity_view
label: hidden
settings:
view_mode: default
link: ''
third_party_settings: { }
weight: 0
region: content
hidden:
field_modal_id: true
langcode: true
118 changes: 118 additions & 0 deletions config/sync/field.field.block_content.modal.field_modal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
uuid: b2cadf02-3ac3-4772-ae71-01b302c4c1a8
langcode: en
status: true
dependencies:
config:
- block_content.type.modal
- field.storage.block_content.field_modal
- paragraphs.paragraphs_type.uswds_modal
module:
- entity_reference_revisions
id: block_content.modal.field_modal
field_name: field_modal
entity_type: block_content
bundle: modal
label: Modal
description: ''
required: true
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:paragraph'
handler_settings:
target_bundles:
uswds_modal: uswds_modal
negate: 0
target_bundles_drag_drop:
b_benefit_eligibility:
weight: 31
enabled: false
b_levent_elg_criteria:
weight: 32
enabled: false
b_levent_elg_criteria_group:
weight: 33
enabled: false
b_levent_elg_section:
weight: 34
enabled: false
b_levent_relevant_benefit:
weight: 35
enabled: false
faq:
weight: 36
enabled: false
text_field:
weight: 37
enabled: false
uswds_2_column_breakpoints:
weight: 39
enabled: false
uswds_2_columns:
weight: 38
enabled: false
uswds_3_column_breakpoints:
weight: 41
enabled: false
uswds_3_columns:
weight: 40
enabled: false
uswds_accordion:
weight: 42
enabled: false
uswds_accordion_section:
weight: 43
enabled: false
uswds_alert:
weight: 44
enabled: false
uswds_card_breakpoints:
weight: 46
enabled: false
uswds_card_group_flag:
weight: 47
enabled: false
uswds_card_group_regular:
weight: 48
enabled: false
uswds_card_regular:
weight: 49
enabled: false
uswds_cards_flag:
weight: 45
enabled: false
uswds_column_equal_size:
weight: 52
enabled: false
uswds_columns_2_uneven:
weight: 50
enabled: false
uswds_columns_3_uneven:
weight: 51
enabled: false
uswds_icon_list:
weight: 53
enabled: false
uswds_icon_list_item:
weight: 54
enabled: false
uswds_modal:
weight: 55
enabled: true
uswds_process_item:
weight: 56
enabled: false
uswds_process_list:
weight: 57
enabled: false
uswds_step_indicator_item:
weight: 58
enabled: false
uswds_step_indicator_list:
weight: 59
enabled: false
uswds_summary_box:
weight: 60
enabled: false
field_type: entity_reference_revisions
19 changes: 19 additions & 0 deletions config/sync/field.field.block_content.modal.field_modal_id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uuid: bd450501-1486-4459-81dd-a6d1511c8295
langcode: en
status: true
dependencies:
config:
- block_content.type.modal
- field.storage.block_content.field_modal_id
id: block_content.modal.field_modal_id
field_name: field_modal_id
entity_type: block_content
bundle: modal
label: 'Modal ID'
description: 'A name to identify this modal for displaying it programatically. Ex: www.usa.gov/?modal=example_modal_id'
akf marked this conversation as resolved.
Show resolved Hide resolved
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string
25 changes: 25 additions & 0 deletions config/sync/field.storage.block_content.field_modal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
uuid: 58dda84e-deff-48c5-b96a-75e7c977bdbb
langcode: en
status: true
dependencies:
module:
- block_content
- entity_reference_revisions
- field_permissions
- paragraphs
third_party_settings:
field_permissions:
permission_type: public
id: block_content.field_modal
field_name: field_modal
entity_type: block_content
type: entity_reference_revisions
settings:
target_type: paragraph
module: entity_reference_revisions
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
25 changes: 25 additions & 0 deletions config/sync/field.storage.block_content.field_modal_id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
uuid: 29e44770-ccd1-44e8-b8cb-44a88db4af07
langcode: en
status: true
dependencies:
module:
- block_content
- field_permissions
third_party_settings:
field_permissions:
permission_type: public
id: block_content.field_modal_id
field_name: field_modal_id
entity_type: block_content
type: string
settings:
max_length: 255
case_sensitive: false
is_ascii: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
11 changes: 11 additions & 0 deletions config/sync/language.content_settings.block_content.modal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: eaa81891-7d18-4bcd-bb8d-54d95a127785
langcode: en
status: true
dependencies:
config:
- block_content.type.modal
id: block_content.modal
target_entity_type_id: block_content
target_bundle: modal
default_langcode: site_default
language_alterable: true
7 changes: 7 additions & 0 deletions config/sync/user.role.content_administrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ langcode: en
status: true
dependencies:
config:
- block_content.type.modal
- block_content.type.site_banner
- media.type.audio
- media.type.file
Expand Down Expand Up @@ -75,6 +76,7 @@ permissions:
- 'create file media'
- 'create image media'
- 'create media'
- 'create modal block content'
- 'create remote_video media'
- 'create site_banner block content'
- 'create state_directory_record content'
Expand All @@ -98,6 +100,8 @@ permissions:
- 'delete any file media'
- 'delete any image media'
- 'delete any media'
- 'delete any modal block content'
- 'delete any modal block content revisions'
- 'delete any remote_video media'
- 'delete any site_banner block content'
- 'delete any site_banner block content revisions'
Expand Down Expand Up @@ -147,6 +151,7 @@ permissions:
- 'edit any directory_record content'
- 'edit any file media'
- 'edit any image media'
- 'edit any modal block content'
- 'edit any remote_video media'
- 'edit any site_banner block content'
- 'edit any state_directory_record content'
Expand All @@ -173,6 +178,7 @@ permissions:
- 'edit terms in wizard'
- 'revert agency_synonym revisions'
- 'revert all revisions'
- 'revert any modal block content revisions'
- 'revert any site_banner block content revisions'
- 'revert basic_page revisions'
- 'revert bears_agency revisions'
Expand Down Expand Up @@ -204,6 +210,7 @@ permissions:
- 'view agency_synonym revisions'
- 'view all media revisions'
- 'view all revisions'
- 'view any modal block content history'
- 'view any site_banner block content history'
- 'view any unpublished content'
- 'view basic_page revisions'
Expand Down
15 changes: 15 additions & 0 deletions web/modules/custom/usa_twig_vars/usa_twig_vars.module
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,21 @@ function usa_twig_vars_preprocess_region(&$variables) {

}
}
// Get all modals from the website
$modal_blocks = \Drupal::entityTypeManager()->getStorage('block_content')->loadByProperties(['type' => 'modal']);
foreach ($modal_blocks as $modal) {
/**
* Check if the language of the modal is the same as the website.
* This prevents incorrect language modals from being displayed on the site.
* */
$modal_lang = $modal->langcode->value;
if ($modal_lang === $site_language) {
$variables['modals'][$modal->id()] = [
"name" => $modal->field_modal_id->value,
"id" => $modal->field_modal[0]->getValue(),
];
}
}
}
}

Expand Down
Loading