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

VACMC-19551: CLP draft promos #19640

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
58c7cbc
VACMS-19551: Updates Promo blocks widget config for CLP
omahane Oct 22, 2024
ae5f953
VACMS-19551: adding patches
edmund-dunn Oct 29, 2024
4a8a0b5
VACMS-19551: Adds latest revision option as true to entity browser
omahane Oct 29, 2024
5519dd2
VACMS-19551: Updates composer.lock
omahane Oct 30, 2024
0a51e28
Updates composer.lock
omahane Oct 30, 2024
702b1ba
VACMS-19551: Updates composer.lock
omahane Oct 30, 2024
1961b08
VACMS-19551: Updates from main.
omahane Oct 31, 2024
82047e5
VACMS-19551: Updates composer.lock
omahane Oct 31, 2024
77987f7
VACMS-19551: Merge of main
omahane Nov 4, 2024
7e3567a
VACMS-19551: Updates the form and field config for promos
omahane Nov 4, 2024
35fd99e
Merge branch 'main' into VACMS-19551-clp-draft-promos
omahane Nov 5, 2024
a07b459
Merge branch 'main' into VACMS-19551-clp-draft-promos
omahane Nov 5, 2024
631f69d
VACMS-19551: updated patch for entity_browser
edmund-dunn Nov 6, 2024
6a5d566
Merge remote-tracking branch 'upstream/main' into VACMS-19551-clp-dra…
omahane Nov 7, 2024
a6204bb
VACMS-19551: updated patch
edmund-dunn Nov 15, 2024
25ad951
VACMS-19551: Updates code that was preventing block removal
omahane Nov 18, 2024
5321729
Merge branch 'main' into VACMS-19551-clp-draft-promos
omahane Nov 18, 2024
66ef4db
VACMS-19551: Updates composer.lock
omahane Nov 18, 2024
ff14deb
Merge branch 'main' into VACMS-19551-clp-draft-promos
omahane Nov 21, 2024
93d65a8
VACMS-19551: updated patch for entity browser
edmund-dunn Nov 25, 2024
ffd53e8
VACMS-19551: Updates branch
omahane Dec 2, 2024
4f7ae4b
VACMS-19551: Updates Cypress (with TODO)
omahane Dec 2, 2024
978c54b
VACMS-19551: Adds test steps
omahane Dec 2, 2024
35edd1c
VACMS-19551: Gets the Cypress test working
omahane Dec 3, 2024
5227993
VACMS-19551: Merge main
omahane Dec 3, 2024
d154b93
VACMS-19551: Removing the IEF-based test
omahane Dec 3, 2024
4908ea8
VACMS-19551: Updates Cypress with new waits
omahane Dec 3, 2024
129cf1f
Merge branch 'main' into VACMS-19551-clp-draft-promos
omahane Dec 3, 2024
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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@
},
"drupal/entity_browser": {
"2856138 - Entity browser cardinality validation": "patches/2856138-entity-browser-cardinality-validation.patch",
"3191302 - Make modal iframe tab accessible": "patches/3191302-make-modal-iframe-tab-accessible.patch"
"3191302 - Make modal iframe tab accessible": "patches/3191302-make-modal-iframe-tab-accessible.patch",
"3483265 - Make it possible to show latest revision in form widget": "patches/3483265-make-it-possible-to-show-latest-revision-in-fomr-widget.patch"
},
"drupal/entity_browser_table": {
"3194622 - Custom field validation should not be applied to remove button": "patches/3794622-limit-remove-button-validators.patch",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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": "f7bb337405568069960a2a9342301edc",
"content-hash": "52f39894774ce36637636fa09295e5bb",
"packages": [
{
"name": "asm89/stack-cors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ status: true
dependencies:
config:
- entity_browser.browser.audiences_checkboxes
- entity_browser.browser.events_browser
- entity_browser.browser.promo_blocks_browser
- field.field.node.campaign_landing_page.field_administration
- field.field.node.campaign_landing_page.field_benefit_categories
- field.field.node.campaign_landing_page.field_clp_audience
Expand Down Expand Up @@ -48,6 +48,7 @@ dependencies:
- node.type.campaign_landing_page
- workflows.workflow.editorial
module:
- change_labels
- content_moderation
- entity_browser
- entity_browser_entity_form
Expand Down Expand Up @@ -320,6 +321,7 @@ content:
field_widget_display_settings: { }
additional_fields:
options: null
show_latest_revision: false
third_party_settings:
limited_field_widgets:
limit_values: 2
Expand All @@ -336,6 +338,7 @@ content:
open: false
field_widget_display_settings: { }
selection_mode: selection_append
show_latest_revision: false
third_party_settings: { }
field_clp_events_header:
type: string_textfield_with_counter
Expand Down Expand Up @@ -375,6 +378,7 @@ content:
field_widget_replace: 0
additional_fields:
options: null
show_latest_revision: false
third_party_settings: { }
field_clp_faq_cta:
type: paragraphs
Expand Down Expand Up @@ -729,26 +733,26 @@ content:
textcount_status_message: '<span class="remaining_count">@remaining_count</span> characters remaining'
third_party_settings: { }
field_clp_what_you_can_do_promos:
type: inline_entity_form_complex_table_view_mode
type: entity_reference_browser_table_widget
weight: 7
region: content
settings:
form_mode: default
override_labels: true
label_singular: Promo
label_plural: Promos
allow_new: true
allow_existing: true
match_operator: CONTAINS
allow_duplicate: false
collapsible: false
collapsed: false
revision: true
removed_reference: optional
allow_system_delete: false
entity_browser: promo_blocks_browser
field_widget_display: linked_title
field_widget_display_settings:
target_blank: '1'
field_widget_edit: '1'
field_widget_remove: '1'
show_latest_revision: '1'
selection_mode: selection_append
additional_fields:
options:
status: status
field_widget_replace: 0
open: 0
third_party_settings:
entity_browser_entity_form:
entity_browser_id: promo_blocks_browser
change_labels:
add_another: ''
field_clp_why_this_matters:
type: string_textarea_with_counter
weight: 2
Expand Down
15 changes: 13 additions & 2 deletions config/sync/entity_browser.browser.promo_blocks_browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
config:
- views.view.custom_block_entity_browsers
module:
- entity_browser_entity_form
- views
name: promo_blocks_browser
label: 'Promo blocks browser'
Expand All @@ -16,16 +17,26 @@ display_configuration:
auto_open: false
selection_display: no_display
selection_display_configuration: { }
widget_selector: single
widget_selector: tabs
widget_selector_configuration: { }
widgets:
03832723-7601-4ed8-82e3-09617277e3bb:
id: view
uuid: 03832723-7601-4ed8-82e3-09617277e3bb
label: ''
label: 'Add existing promo'
weight: 1
settings:
submit_text: 'Select promo'
auto_select: false
view: custom_block_entity_browsers
view_display: entity_browser_2
0fd08d3a-6f12-4949-8672-19dd8d928877:
id: entity_form
uuid: 0fd08d3a-6f12-4949-8672-19dd8d928877
label: 'Add new promo'
weight: 2
settings:
submit_text: 'Save promo'
entity_type: block_content
bundle: promo
form_mode: default
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ dependencies:
- node.type.campaign_landing_page
module:
- entity_reference_validators
- tmgmt_content
third_party_settings:
entity_reference_validators:
circular_reference: false
circular_reference_deep: false
duplicate_reference: true
tmgmt_content:
excluded: false
id: node.campaign_landing_page.field_clp_what_you_can_do_promos
field_name: field_clp_what_you_can_do_promos
entity_type: node
Expand All @@ -29,6 +33,7 @@ settings:
promo: promo
sort:
field: _none
auto_create: false
direction: ASC
auto_create: true
auto_create_bundle: ''
field_type: entity_reference
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function __construct(
UserPermsService $user_perms_service,
WorkflowContentControl $workflow_content_control,
Flagger $flagger,
NotificationsManager $notifications_manager
NotificationsManager $notifications_manager,
) {
$this->entityTypeManager = $entity_type_manager;
$this->userPermsService = $user_perms_service;
Expand Down Expand Up @@ -351,7 +351,7 @@ protected function getIefTypeFields(NodeInterface $node): array {
$field_displays = $form_display->toArray();

foreach ($field_displays['content'] as $field_name => $field_display) {
if ($this->isNodeIef($node, $field_name)) {
if ($this->isNodeOrBlockIef($node, $field_name)) {
$operations = [
'field_widget_edit' => !empty($field_display['settings']['field_widget_edit']),
'field_widget_remove' => !empty($field_display['settings']['field_widget_remove']),
Expand All @@ -366,7 +366,7 @@ protected function getIefTypeFields(NodeInterface $node): array {
}

/**
* Checks to see if a field is an entity reference that targets a node.
* Determines whether an entity reference targets a node or content block.
*
* @param \Drupal\node\NodeInterface $node
* The node object.
Expand All @@ -376,7 +376,7 @@ protected function getIefTypeFields(NodeInterface $node): array {
* @return bool
* TRUE if it is an ief field targeting a node, FALSE otherwise.
*/
protected function isNodeIef(NodeInterface $node, $field_name): bool {
protected function isNodeOrBlockIef(NodeInterface $node, $field_name): bool {
$field_definition = $node->getFieldDefinition($field_name);
if (empty($field_definition)) {
return FALSE;
Expand All @@ -388,7 +388,7 @@ protected function isNodeIef(NodeInterface $node, $field_name): bool {
];
$target_type = $field_definition->getItemDefinition()->getSettings()['target_type'] ?? '';

return (in_array($fieldType, $field_types_for_ief)) && ($target_type === "node");
return (in_array($fieldType, $field_types_for_ief)) && ($target_type === "node" || $target_type === "block_content");
}

/**
Expand Down
Loading
Loading