From 8db3a16636626e5855eb13760325115471d16d2e Mon Sep 17 00:00:00 2001 From: Vincent Gao Date: Thu, 21 Nov 2024 18:20:25 +1100 Subject: [PATCH] [SD-416] Fixes placeholder issue for `Header links` --- ...d.paragraph.key_journeys.field_paragraph_title.yml | 4 +--- modules/tide_landing_page/tide_landing_page.install | 11 ++++++++++- modules/tide_landing_page/tide_landing_page.module | 6 ++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/tide_landing_page/config/install/field.field.paragraph.key_journeys.field_paragraph_title.yml b/modules/tide_landing_page/config/install/field.field.paragraph.key_journeys.field_paragraph_title.yml index 4ed3c4bc8..4b8e778a0 100644 --- a/modules/tide_landing_page/config/install/field.field.paragraph.key_journeys.field_paragraph_title.yml +++ b/modules/tide_landing_page/config/install/field.field.paragraph.key_journeys.field_paragraph_title.yml @@ -12,9 +12,7 @@ label: Title description: '' required: true translatable: true -default_value: - - - value: 'Want to know more about...' +default_value: { } default_value_callback: '' settings: { } field_type: string diff --git a/modules/tide_landing_page/tide_landing_page.install b/modules/tide_landing_page/tide_landing_page.install index 243e63264..de73d8b3d 100644 --- a/modules/tide_landing_page/tide_landing_page.install +++ b/modules/tide_landing_page/tide_landing_page.install @@ -185,7 +185,7 @@ function tide_landing_page_update_10106() { $form_configs = [ 'field.field.node.landing_page.field_landing_page_component', ]; - /** @var \Drupal\tide_core\TideEntityUpdateHelper $s */ + /** @var \Drupal\tide_core\TideEntityUpdateHelper $tide_update_helper */ $tide_update_helper = \Drupal::service('tide_core.entity_update_helper'); $tide_update_helper->configMergeDeep('tide_landing_page', TideEntityUpdateHelper::INSTALL_DIR, $form_configs); $result = $tide_update_helper->updateFromOptional('base_field_override', 'paragraphs_library_item.paragraphs_library_item.paragraphs'); @@ -194,3 +194,12 @@ function tide_landing_page_update_10106() { } } + +/** + * Update key_journeys.field_paragraph_title configs. + */ +function tide_landing_page_update_10107() { + /** @var \Drupal\tide_core\TideEntityUpdateHelper $tide_update_helper */ + $tide_update_helper = \Drupal::service('tide_core.entity_update_helper'); + $tide_update_helper->revert('field_config', 'paragraph.key_journeys.field_paragraph_title'); +} diff --git a/modules/tide_landing_page/tide_landing_page.module b/modules/tide_landing_page/tide_landing_page.module index 1cd98a751..1aa1f5fe0 100644 --- a/modules/tide_landing_page/tide_landing_page.module +++ b/modules/tide_landing_page/tide_landing_page.module @@ -82,10 +82,8 @@ function tide_landing_page_form_node_form_alter(&$form, FormStateInterface $form if (isset($form['title']['widget'][0]['value']['#description'])) { $form['title']['widget'][0]['value']['#description'] = t('Include a short unique title for your page and keywords.'); } - if (isset($form["field_landing_page_key_journeys"]["widget"][0]["subform"]["field_paragraph_title"]["widget"][0]["value"]["#default_value"])) { - $placeholder_value = $form["field_landing_page_key_journeys"]["widget"][0]["subform"]["field_paragraph_title"]["widget"][0]["value"]["#default_value"]; - $form["field_landing_page_key_journeys"]["widget"][0]["subform"]["field_paragraph_title"]["widget"][0]["value"]["#placeholder"] = $placeholder_value; - unset($form["field_landing_page_key_journeys"]["widget"][0]["subform"]["field_paragraph_title"]["widget"][0]["value"]["#default_value"]); + if (isset($form["field_landing_page_key_journeys"]["widget"][0]["subform"]["field_paragraph_title"]["widget"][0])) { + $form["field_landing_page_key_journeys"]["widget"][0]["subform"]["field_paragraph_title"]["widget"][0]["value"]["#placeholder"] = t("Want to know more about..."); } // Change form layout. $form['#attached']['library'][] = 'tide_landing_page/landing_page_form';