diff --git a/modules/order/src/Element/ProfileSelect.php b/modules/order/src/Element/ProfileSelect.php
index 7415729c..3fca2b01 100644
--- a/modules/order/src/Element/ProfileSelect.php
+++ b/modules/order/src/Element/ProfileSelect.php
@@ -178,7 +178,6 @@ class ProfileSelect extends RenderElement {
$element['#wrapper_id'] = $wrapper_id;
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('profile');
$element['profile_selection'] = [
- '#prefix' => "
",
'#type' => 'select',
'#title' => $element['#title'],
'#options' => $profile_options,
@@ -194,7 +193,7 @@ class ProfileSelect extends RenderElement {
$element['profile'] = $view_builder->view($element['#profile'], 'default');
$element['profile']['#suffix'] = '
';
$url = Url::fromRoute('entity.profile.type.user_profile_form.add', ['user' => $element['#profile']->getOwnerId(), 'profile_type' => 'customer']);
- $url->mergeOptions(['query' => \Drupal::destination()->getAsArray()]);
+ $url->mergeOptions(['query' => ['destination' => \Drupal::service('path.current')->getPath()]]);
$element['new'] = [
'#type' => 'link',
'#url' => $url,
@@ -212,7 +211,7 @@ class ProfileSelect extends RenderElement {
];
if (!$element['#profile']->isNew()) {
$url = Url::fromRoute('entity.profile.edit_form', ['profile' => $element['#profile']->id()]);
- $url->mergeOptions(['query' => \Drupal::destination()->getAsArray()]);
+ $url->mergeOptions(['query' => ['destination' => \Drupal::service('path.current')->getPath()]]);
$element['edit'] = [
'#type' => 'link',
'#url' => $url,
@@ -229,6 +228,7 @@ class ProfileSelect extends RenderElement {
],
];
}
+ $element['#prefix'] = "";
$element['#attached']['library'][] = 'core/drupal.dialog.ajax';
} else {
$form_display = EntityFormDisplay::collectRenderDisplay($element['#profile'], 'default');
@@ -272,10 +272,7 @@ class ProfileSelect extends RenderElement {
public static function ajaxRefresh(array &$form, FormStateInterface $form_state) {
$triggering_element = $form_state->getTriggeringElement();
$element = NestedArray::getValue($form, array_slice($triggering_element['#array_parents'], 0, -1));
- return [
- 'profile_selection' => $element['profile_selection'],
- 'profile' => $element['profile'],
- ];
+ return $element;
}
/**