Skip to content

Commit

Permalink
TP-1166 merge fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Iiro Järvenpää authored and Iiro Järvenpää committed Feb 27, 2024
2 parents f587022 + 34aed09 commit b56b5f4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
6 changes: 6 additions & 0 deletions config/sync/core.menu.static_menu_link_overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ definitions:
weight: 0
expanded: false
enabled: false
user__page:
weight: 10
enabled: false
menu_name: account
parent: ''
expanded: false
13 changes: 13 additions & 0 deletions public/modules/custom/hel_tpm_forms/hel_tpm_forms.module
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ function hel_tpm_forms_node_service_form_alter_helper(&$form, FormStateInterface
],
];

// Check if current service provider user is included in the options list. If
// not, add a 'none' option so that when saving the form, a new user must be
// chosen. This prevents accidentally saving with the first user in the list
// when the current selection is no longer included in the list.
if ($node = $form_state->getFormObject()?->getEntity()) {
if ($current_provider_user = $node?->get('field_service_provider_updatee')?->first()?->getValue()['target_id'] &&
$provider_user_options = $form['field_service_provider_updatee']['widget']['#options']) {
if (!array_key_exists($current_provider_user, $provider_user_options)) {
$form['field_service_provider_updatee']['widget']['#options'] = ['_none' => t("- Select a value -")] + $provider_user_options;
}
}
}

$form['paging_footer'] = [
'#theme' => 'hel_tpm_steps',
];
Expand Down
22 changes: 22 additions & 0 deletions public/modules/custom/hel_tpm_general/hel_tpm_general.install
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use Drupal\Core\Config\FileStorage;
use Drupal\Core\Site\Settings;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\hel_tpm_general\PreventMailUtility;
use Drupal\node\Entity\Node;

Expand Down Expand Up @@ -619,6 +620,27 @@ function hel_tpm_general_update_10108(&$sandbox) {
$sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
}

/**
* Create My account menu link and translations.
*/
function hel_tpm_general_update_10109(&$sandbox) {
$menu_link = MenuLinkContent::create([
'title' => 'Oma käyttäjätilini',
'link' => ['uri' => 'internal:/user/edit'],
'menu_name' => 'account',
'expanded' => TRUE,
'weight' => -10
]);
$menu_link->save();
$translation = $menu_link->addTranslation('en');
$translation->set('title', 'My account');
$translation->save();

$translation = $menu_link->addTranslation('sv');
$translation->set('title', 'Mitt konto');
$translation->save();
}

/**
* Helper function to migrate service language paragraphs to node field.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
}
}
}
&:last-child() {
&:last-child {
margin-bottom: 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion public/themes/custom/palvelumanuaali/dist/css/style.css

Large diffs are not rendered by default.

0 comments on commit b56b5f4

Please sign in to comment.