Skip to content

Commit

Permalink
[SD-416] Fixes placeholder issue for Header links (#542)
Browse files Browse the repository at this point in the history
* [SD-416] Fixes placeholder issue for `Header links`

* Fix a coding standard issue.
  • Loading branch information
vincent-gao authored Nov 25, 2024
1 parent 67eab3a commit 6aa0bae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 10 additions & 1 deletion modules/tide_landing_page/tide_landing_page.install
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
}
6 changes: 2 additions & 4 deletions modules/tide_landing_page/tide_landing_page.module
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 6aa0bae

Please sign in to comment.