From f8a13634425408e42f72093065f99a84996150ce Mon Sep 17 00:00:00 2001 From: Vincent Gao Date: Fri, 2 Aug 2024 08:06:25 +1000 Subject: [PATCH] fix: SDP-112 TEST --- ...rm_display.taxonomy_term.sites.default.yml | 139 +++++++++++++++++- ...term.sites.field_bottom_corner_graphic.yml | 0 ...taxonomy_term.sites.field_site_favicon.yml | 0 ...my_term.sites.field_site_feature_flags.yml | 0 ...omy_term.sites.field_site_theme_values.yml | 0 ...my_term.sites.field_top_corner_graphic.yml | 0 ...onomy_term.field_bottom_corner_graphic.yml | 0 ...orage.taxonomy_term.field_site_favicon.yml | 0 ...taxonomy_term.field_site_feature_flags.yml | 0 ....taxonomy_term.field_site_theme_values.yml | 0 ...taxonomy_term.field_top_corner_graphic.yml | 0 tide_site.info.yml | 1 + tide_site.install | 25 +++- 13 files changed, 151 insertions(+), 14 deletions(-) rename {modules/tide_site_theming/config => config}/install/field.field.taxonomy_term.sites.field_bottom_corner_graphic.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.field.taxonomy_term.sites.field_site_favicon.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.field.taxonomy_term.sites.field_site_feature_flags.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.field.taxonomy_term.sites.field_site_theme_values.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.field.taxonomy_term.sites.field_top_corner_graphic.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.storage.taxonomy_term.field_bottom_corner_graphic.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.storage.taxonomy_term.field_site_favicon.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.storage.taxonomy_term.field_site_feature_flags.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.storage.taxonomy_term.field_site_theme_values.yml (100%) rename {modules/tide_site_theming/config => config}/install/field.storage.taxonomy_term.field_top_corner_graphic.yml (100%) diff --git a/config/install/core.entity_form_display.taxonomy_term.sites.default.yml b/config/install/core.entity_form_display.taxonomy_term.sites.default.yml index 8976a348..8af48aab 100644 --- a/config/install/core.entity_form_display.taxonomy_term.sites.default.yml +++ b/config/install/core.entity_form_display.taxonomy_term.sites.default.yml @@ -5,10 +5,13 @@ dependencies: - entity_browser.browser.tide_image_browser - field.field.taxonomy_term.sites.field_acknowledgement_to_country - field.field.taxonomy_term.sites.field_additional_comment + - field.field.taxonomy_term.sites.field_bottom_corner_graphic - field.field.taxonomy_term.sites.field_print_friendly_logo - field.field.taxonomy_term.sites.field_prominence_ack_to_country - field.field.taxonomy_term.sites.field_show_table_of_contents - field.field.taxonomy_term.sites.field_site_domains + - field.field.taxonomy_term.sites.field_site_favicon + - field.field.taxonomy_term.sites.field_site_feature_flags - field.field.taxonomy_term.sites.field_site_footer_logos - field.field.taxonomy_term.sites.field_site_footer_menu - field.field.taxonomy_term.sites.field_site_footer_text @@ -19,16 +22,21 @@ dependencies: - field.field.taxonomy_term.sites.field_site_show_exit_site - field.field.taxonomy_term.sites.field_site_slogan - field.field.taxonomy_term.sites.field_site_social_links + - field.field.taxonomy_term.sites.field_site_theme_values - field.field.taxonomy_term.sites.field_site_twitter_image - field.field.taxonomy_term.sites.field_title_of_table_of_contents + - field.field.taxonomy_term.sites.field_top_corner_graphic - image.style.thumbnail - taxonomy.vocabulary.sites module: - entity_browser + - field_group - file + - key_value_field - link - maxlength - paragraphs + - svg_image - text third_party_settings: field_group: @@ -39,7 +47,7 @@ third_party_settings: label: 'Table of contents' region: content parent_name: '' - weight: 19 + weight: 18 format_type: details format_settings: classes: '' @@ -48,6 +56,67 @@ third_party_settings: open: false description: '' required_fields: true + group_site_theme_values: + children: + - field_site_theme_values + label: 'Site theme values' + region: content + parent_name: '' + weight: 19 + format_type: details + format_settings: + classes: '' + show_empty_fields: false + id: tide-site-theming-fileds + open: false + required_fields: true + effect: none + group_site_feature_flag_values: + children: + - field_site_feature_flags + label: 'Site feature flag values' + region: content + parent_name: '' + weight: 20 + format_type: details + format_settings: + classes: '' + show_empty_fields: false + id: tide-feature-flag-fields + open: false + required_fields: true + effect: none + group_site_favicon_value: + children: + - field_site_favicon + label: 'Site favicon value' + region: content + parent_name: '' + weight: 21 + format_type: details + format_settings: + classes: '' + show_empty_fields: false + id: tide-site-favicon-field + open: false + required_fields: true + effect: none + group_site_header_corner_graphic: + children: + - field_top_corner_graphic + - field_bottom_corner_graphic + label: 'Site header corner graphics' + region: content + parent_name: '' + weight: 22 + format_type: details + format_settings: + classes: '' + show_empty_fields: false + id: tide-site-header-corner-graphics + open: false + required_fields: true + effect: none id: taxonomy_term.sites.default targetEntityType: taxonomy_term bundle: sites @@ -55,7 +124,7 @@ mode: default content: field_acknowledgement_to_country: type: string_textarea - weight: 13 + weight: 12 region: content settings: rows: 5 @@ -69,6 +138,14 @@ content: rows: 5 placeholder: '' third_party_settings: { } + field_bottom_corner_graphic: + type: image_image + weight: 1 + region: content + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } field_print_friendly_logo: type: file_generic weight: 3 @@ -78,7 +155,7 @@ content: third_party_settings: { } field_prominence_ack_to_country: type: string_textarea - weight: 14 + weight: 13 region: content settings: rows: 5 @@ -104,6 +181,30 @@ content: maxlength_js_label: 'Content limited to @limit characters, remaining: @remaining' maxlength_js_enforce: false maxlength_js_truncate_html: false + field_site_favicon: + type: image_image + weight: 0 + region: content + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } + field_site_feature_flags: + type: key_value_textfield + weight: 0 + region: content + settings: + size: 60 + placeholder: '' + key_label: Key + value_label: Value + description_label: Description + description_rows: 5 + key_size: 60 + key_placeholder: '' + description_enabled: true + description_placeholder: '' + third_party_settings: { } field_site_footer_logos: type: entity_reference_paragraphs weight: 9 @@ -165,7 +266,7 @@ content: third_party_settings: { } field_site_og_image: type: entity_browser_entity_reference - weight: 15 + weight: 14 region: content settings: entity_browser: tide_image_browser @@ -195,7 +296,7 @@ content: third_party_settings: { } field_site_social_links: type: link_default - weight: 17 + weight: 16 region: content settings: placeholder_url: 'https://example.com/Social' @@ -204,9 +305,25 @@ content: maxlength: maxlength_js: 35 maxlength_js_label: 'Link text limited to @limit characters, remaining: @remaining' + field_site_theme_values: + type: key_value_textfield + weight: 0 + region: content + settings: + size: 60 + placeholder: '' + key_label: Key + value_label: Value + description_label: Description + description_rows: 5 + key_size: 60 + key_placeholder: '' + description_enabled: true + description_placeholder: '' + third_party_settings: { } field_site_twitter_image: type: entity_browser_entity_reference - weight: 16 + weight: 15 region: content settings: entity_browser: tide_image_browser @@ -227,6 +344,14 @@ content: size: 60 placeholder: '' third_party_settings: { } + field_top_corner_graphic: + type: image_image + weight: 0 + region: content + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } name: type: string_textfield weight: 0 @@ -237,7 +362,7 @@ content: third_party_settings: { } status: type: boolean_checkbox - weight: 18 + weight: 17 region: content settings: display_label: true diff --git a/modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_bottom_corner_graphic.yml b/config/install/field.field.taxonomy_term.sites.field_bottom_corner_graphic.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_bottom_corner_graphic.yml rename to config/install/field.field.taxonomy_term.sites.field_bottom_corner_graphic.yml diff --git a/modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_site_favicon.yml b/config/install/field.field.taxonomy_term.sites.field_site_favicon.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_site_favicon.yml rename to config/install/field.field.taxonomy_term.sites.field_site_favicon.yml diff --git a/modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_site_feature_flags.yml b/config/install/field.field.taxonomy_term.sites.field_site_feature_flags.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_site_feature_flags.yml rename to config/install/field.field.taxonomy_term.sites.field_site_feature_flags.yml diff --git a/modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_site_theme_values.yml b/config/install/field.field.taxonomy_term.sites.field_site_theme_values.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_site_theme_values.yml rename to config/install/field.field.taxonomy_term.sites.field_site_theme_values.yml diff --git a/modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_top_corner_graphic.yml b/config/install/field.field.taxonomy_term.sites.field_top_corner_graphic.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.field.taxonomy_term.sites.field_top_corner_graphic.yml rename to config/install/field.field.taxonomy_term.sites.field_top_corner_graphic.yml diff --git a/modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_bottom_corner_graphic.yml b/config/install/field.storage.taxonomy_term.field_bottom_corner_graphic.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_bottom_corner_graphic.yml rename to config/install/field.storage.taxonomy_term.field_bottom_corner_graphic.yml diff --git a/modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_site_favicon.yml b/config/install/field.storage.taxonomy_term.field_site_favicon.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_site_favicon.yml rename to config/install/field.storage.taxonomy_term.field_site_favicon.yml diff --git a/modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_site_feature_flags.yml b/config/install/field.storage.taxonomy_term.field_site_feature_flags.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_site_feature_flags.yml rename to config/install/field.storage.taxonomy_term.field_site_feature_flags.yml diff --git a/modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_site_theme_values.yml b/config/install/field.storage.taxonomy_term.field_site_theme_values.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_site_theme_values.yml rename to config/install/field.storage.taxonomy_term.field_site_theme_values.yml diff --git a/modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_top_corner_graphic.yml b/config/install/field.storage.taxonomy_term.field_top_corner_graphic.yml similarity index 100% rename from modules/tide_site_theming/config/install/field.storage.taxonomy_term.field_top_corner_graphic.yml rename to config/install/field.storage.taxonomy_term.field_top_corner_graphic.yml diff --git a/tide_site.info.yml b/tide_site.info.yml index d2739c88..c6907d97 100644 --- a/tide_site.info.yml +++ b/tide_site.info.yml @@ -12,6 +12,7 @@ dependencies: - drupal:text - drupal:user - drupal:path_alias + - key_value_field:key_value_field - pathauto:pathauto - dpc-sdp:tide_core - dpc-sdp:tide_media diff --git a/tide_site.install b/tide_site.install index 99d9add5..329f8110 100644 --- a/tide_site.install +++ b/tide_site.install @@ -5,6 +5,8 @@ * Install file for tide_site. */ +use Drupal\Component\Utility\NestedArray; + /** * Implements hook_install(). */ @@ -22,7 +24,7 @@ function tide_site_install() { * New field taxonomy image logo. */ function tide_site_update_10001() { - module_load_include('inc', 'tide_core', 'includes/helpers'); + \Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers'); $config_location = [\Drupal::service('extension.list.module')->getPath('tide_site') . '/config/install']; $configs = [ @@ -42,11 +44,20 @@ function tide_site_update_10001() { 'core.entity_view_display.taxonomy_term.sites.default', ]; 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(); + $rewrite = _tide_read_config($form_config, $config_location, FALSE); + $display_config_entity = \Drupal::configFactory()->getEditable($form_config); + $original_config = $display_config_entity->getRawData(); + $rewritten_config = NestedArray::mergeDeep($original_config, $rewrite); + if ($rewritten_config['dependencies']) { + $dependencies = $rewritten_config['dependencies']; + foreach ($dependencies as $type => $items) { + $uniqueItems = array_unique($items); + sort($uniqueItems); + $dependencies[$type] = $uniqueItems; + } + $rewritten_config['dependencies'] = $dependencies; + } + $display_config_entity->setData($rewritten_config); + $display_config_entity->save(); } }