Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
[R20-1547] Add secondary campaign to search listing (#57)
Browse files Browse the repository at this point in the history
* Add first cut at config for secondary campaign added to search listing

* Update composer for testing in reference

* Invert order so it imports correctly

* Reconfigure import to work with existing form handlers

* Revert composer changes to be compatible with merge to dev
  • Loading branch information
krakerag authored Oct 1, 2023
1 parent a3017b4 commit 92ab2b4
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies:
- field.field.node.tide_search_listing.field_custom_sort_configuration
- field.field.node.tide_search_listing.field_featured_image
- field.field.node.tide_search_listing.field_header_components
- field.field.node.tide_search_listing.field_landing_page_c_secondary
- field.field.node.tide_search_listing.field_landing_page_intro_text
- field.field.node.tide_search_listing.field_landing_page_summary
- field.field.node.tide_search_listing.field_layout_component
Expand Down Expand Up @@ -142,7 +143,7 @@ mode: default
content:
created:
type: datetime_timestamp
weight: 13
weight: 14
region: content
settings: { }
third_party_settings: { }
Expand Down Expand Up @@ -193,6 +194,16 @@ content:
collapse_edit_all: collapse_edit_all
duplicate: duplicate
third_party_settings: { }
field_landing_page_c_secondary:
type: entity_reference_autocomplete
weight: 9
region: content
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
field_landing_page_intro_text:
type: string_textarea
weight: 3
Expand Down Expand Up @@ -286,22 +297,22 @@ content:
third_party_settings: { }
field_metatags:
type: metatag_firehose
weight: 21
weight: 22
region: content
settings:
sidebar: true
use_details: true
third_party_settings: { }
field_node_primary_site:
type: options_buttons
weight: 23
weight: 24
region: content
settings: { }
third_party_settings: { }
field_name: field_node_primary_site
field_node_site:
type: options_buttons
weight: 22
weight: 23
region: content
settings: { }
third_party_settings: { }
Expand Down Expand Up @@ -343,14 +354,14 @@ content:
third_party_settings: { }
field_show_content_rating:
type: boolean_checkbox
weight: 11
weight: 12
region: content
settings:
display_label: true
third_party_settings: { }
field_tags:
type: entity_reference_autocomplete
weight: 20
weight: 21
region: content
settings:
match_operator: CONTAINS
Expand All @@ -360,7 +371,7 @@ content:
third_party_settings: { }
field_topic:
type: entity_reference_autocomplete
weight: 9
weight: 10
region: content
settings:
match_operator: CONTAINS
Expand All @@ -370,38 +381,38 @@ content:
third_party_settings: { }
moderation_state:
type: moderation_state_default
weight: 19
weight: 20
region: content
settings: { }
third_party_settings: { }
path:
type: path
weight: 15
weight: 16
region: content
settings: { }
third_party_settings: { }
promote:
type: boolean_checkbox
weight: 10
weight: 11
region: content
settings:
display_label: true
third_party_settings: { }
simple_sitemap:
weight: 18
weight: 19
region: content
settings: { }
third_party_settings: { }
status:
type: boolean_checkbox
weight: 17
weight: 18
region: content
settings:
display_label: true
third_party_settings: { }
sticky:
type: boolean_checkbox
weight: 14
weight: 15
region: content
settings:
display_label: true
Expand All @@ -416,7 +427,7 @@ content:
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 12
weight: 13
region: content
settings:
match_operator: CONTAINS
Expand All @@ -425,7 +436,7 @@ content:
placeholder: ''
third_party_settings: { }
url_redirects:
weight: 16
weight: 17
region: content
settings: { }
third_party_settings: { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies:
- field.field.node.tide_search_listing.field_custom_sort_configuration
- field.field.node.tide_search_listing.field_featured_image
- field.field.node.tide_search_listing.field_header_components
- field.field.node.tide_search_listing.field_landing_page_c_secondary
- field.field.node.tide_search_listing.field_landing_page_intro_text
- field.field.node.tide_search_listing.field_landing_page_summary
- field.field.node.tide_search_listing.field_layout_component
Expand Down Expand Up @@ -73,6 +74,14 @@ content:
third_party_settings: { }
weight: 112
region: content
field_landing_page_c_secondary:
type: entity_reference_label
label: above
settings:
link: true
third_party_settings: { }
weight: 121
region: content
field_landing_page_intro_text:
type: basic_string
label: above
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
- field.field.node.tide_search_listing.field_custom_sort_configuration
- field.field.node.tide_search_listing.field_featured_image
- field.field.node.tide_search_listing.field_header_components
- field.field.node.tide_search_listing.field_landing_page_c_secondary
- field.field.node.tide_search_listing.field_landing_page_intro_text
- field.field.node.tide_search_listing.field_landing_page_summary
- field.field.node.tide_search_listing.field_layout_component
Expand Down Expand Up @@ -48,6 +49,7 @@ hidden:
field_custom_sort_configuration: true
field_featured_image: true
field_header_components: true
field_landing_page_c_secondary: true
field_landing_page_intro_text: true
field_landing_page_summary: true
field_layout_component: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_landing_page_c_secondary
- node.type.tide_search_listing
id: node.tide_search_listing.field_landing_page_c_secondary
field_name: field_landing_page_c_secondary
entity_type: node
bundle: tide_search_listing
label: 'Secondary campaign'
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
handler: 'default:block_content'
handler_settings: { }
field_type: entity_reference
32 changes: 32 additions & 0 deletions tide_search.install
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,35 @@ function tide_search_update_8006() {
$module_installer->install(['tide_data_pipeline']);
}
}

/**
* Add secondary campaign to search listing.
*/
function tide_search_update_8007() {
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_search') . '/config/optional'];

$config = 'field.field.node.tide_search_listing.field_landing_page_c_secondary';
$type = 'field_config';
$config_read = _tide_read_config($config, $config_location);
$storage = \Drupal::entityTypeManager()->getStorage($type);
$id = substr($config, strrpos($config, '.') + 1);
if ($storage->load($id) == NULL) {
$config_entity = $storage->createFromStorageRecord($config_read);
$config_entity->save();
}

$form_configs = [
'core.entity_view_display.node.tide_search_listing.default',
'core.entity_form_display.node.tide_search_listing.default',
'core.entity_view_display.node.tide_search_listing.teaser',
];
foreach ($form_configs as $form_config) {
$config = \Drupal::configFactory()->getEditable($form_config);
$config_read = _tide_read_config($form_config, $config_location, FALSE);
$config->set('dependencies', $config_read['dependencies']);
$config->set('content', $config_read['content']);
$config->set('hidden', $config_read['hidden']);
$config->save();
}
}

0 comments on commit 92ab2b4

Please sign in to comment.