'),
'#options' => array(
'language' => $languages['en'],
'attributes' => array(
diff --git a/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php b/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php
index ea47019..a3b525d 100644
--- a/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php
+++ b/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php
@@ -180,26 +180,21 @@ public function getDescription() {
* {@inheritdoc}
*/
public function getDeleteRoute() {
- return array(
- 'route_name' => 'entity.menu_link_content.delete_form',
- 'route_parameters' => array('menu_link_content' => $this->getEntity()->id()),
- );
+ return $this->getEntity()->urlInfo('delete-form');
}
/**
* {@inheritdoc}
*/
public function getEditRoute() {
- return array(
- 'route_name' => 'entity.menu_link_content.canonical',
- 'route_parameters' => array('menu_link_content' => $this->getEntity()->id()),
- );
+ return $this->getEntity()->urlInfo();
}
/**
* {@inheritdoc}
*/
public function getTranslateRoute() {
+ return $this->getEntity()->urlInfo('drupal:content-translation-overview');
$entity_type = 'menu_link_content';
return array(
'route_name' => 'content_translation.translation_overview_' . $entity_type,
diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php
index 720aa2b..f0f42b9 100644
--- a/core/modules/menu_ui/src/MenuForm.php
+++ b/core/modules/menu_ui/src/MenuForm.php
@@ -18,6 +18,7 @@
use Drupal\Core\Menu\MenuTreeParameters;
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\UrlGeneratorTrait;
+use Drupal\Core\Url;
use Drupal\Core\Utility\LinkGeneratorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -306,23 +307,21 @@ protected function buildOverviewTreeForm($tree, $delta) {
// Allow for a custom edit link per plugin.
$edit_route = $link->getEditRoute();
if ($edit_route) {
- $operations['edit'] += $edit_route;
+ $operations['edit']['url'] = $edit_route;
// Bring the user back to the menu overview.
$operations['edit']['query']['destination'] = $this->entity->url();
}
else {
// Fall back to the standard edit link.
$operations['edit'] += array(
- 'route_name' => 'menu_ui.link_edit',
- 'route_parameters' => array('menu_link_plugin' => $link->getPluginId()),
+ 'url' => Url::fromRoute('menu_ui.link_edit', array('menu_link_plugin' => $link->getPluginId())),
);
}
// Links can either be reset or deleted, not both.
if ($link->isResettable()) {
$operations['reset'] = array(
'title' => $this->t('Reset'),
- 'route_name' => 'menu_ui.link_reset',
- 'route_parameters' => array('menu_link_plugin' => $link->getPluginId()),
+ 'url' => Url::fromRoute('menu_ui.link_reset', array('menu_link_plugin' => $link->getPluginId())),
);
}
elseif ($delete_link = $link->getDeleteRoute()) {
@@ -333,7 +332,8 @@ protected function buildOverviewTreeForm($tree, $delta) {
if ($link->isTranslatable()) {
$operations['translate'] = array(
'title' => $this->t('Translate'),
- ) + (array) $link->getTranslateRoute();
+ 'url' => $link->getTranslateRoute(),
+ );
}
$form[$id]['operations'] = array(
'#type' => 'operations',
diff --git a/core/modules/menu_ui/src/MenuListBuilder.php b/core/modules/menu_ui/src/MenuListBuilder.php
index 4fdb298..7e987f1 100644
--- a/core/modules/menu_ui/src/MenuListBuilder.php
+++ b/core/modules/menu_ui/src/MenuListBuilder.php
@@ -54,7 +54,8 @@ public function getDefaultOperations(EntityInterface $entity) {
$operations['add'] = array(
'title' => t('Add link'),
'weight' => 20,
- ) + $entity->urlInfo('add-link-form')->toArray();
+ 'url' => $entity->urlInfo('add-link-form'),
+ );
}
if (isset($operations['delete'])) {
$operations['delete']['title'] = t('Delete menu');
diff --git a/core/modules/responsive_image/src/ResponsiveImageMappingListBuilder.php b/core/modules/responsive_image/src/ResponsiveImageMappingListBuilder.php
index b12fb61..6032b7c 100644
--- a/core/modules/responsive_image/src/ResponsiveImageMappingListBuilder.php
+++ b/core/modules/responsive_image/src/ResponsiveImageMappingListBuilder.php
@@ -41,7 +41,8 @@ public function getDefaultOperations(EntityInterface $entity) {
$operations['duplicate'] = array(
'title' => t('Duplicate'),
'weight' => 15,
- ) + $entity->urlInfo('duplicate-form')->toArray();
+ 'url' => $entity->urlInfo('duplicate-form'),
+ );
return $operations;
}
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index 8150bf2..2930fcb 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -366,7 +366,7 @@ function shortcut_toolbar() {
$configure_link = array(
'#type' => 'link',
'#title' => t('Edit shortcuts'),
- '#url' => Url::fromRoute('entity.shortcut_set.customize_form', ['shortcut_set' => $shortcut_set->id()])
+ '#url' => Url::fromRoute('entity.shortcut_set.customize_form', ['shortcut_set' => $shortcut_set->id()]),
'#options' => array('attributes' => array('class' => array('edit-shortcuts'))),
);
}
diff --git a/core/modules/shortcut/src/ShortcutSetListBuilder.php b/core/modules/shortcut/src/ShortcutSetListBuilder.php
index 907f470..9de658d 100644
--- a/core/modules/shortcut/src/ShortcutSetListBuilder.php
+++ b/core/modules/shortcut/src/ShortcutSetListBuilder.php
@@ -37,7 +37,8 @@ public function getDefaultOperations(EntityInterface $entity) {
$operations['list'] = array(
'title' => t('List links'),
- ) + $entity->urlInfo('customize-form')->toArray();
+ 'url' => $entity->urlInfo('customize-form'),
+ );
return $operations;
}
diff --git a/core/modules/simpletest/src/AssertContentTrait.php b/core/modules/simpletest/src/AssertContentTrait.php
index 7c28b04..4e68c57 100644
--- a/core/modules/simpletest/src/AssertContentTrait.php
+++ b/core/modules/simpletest/src/AssertContentTrait.php
@@ -742,11 +742,6 @@ protected function assertNoTitle($title, $message = '', $group = 'Other') {
*/
protected function assertThemeOutput($callback, array $variables = array(), $expected = '', $message = '', $group = 'Other') {
$output = \Drupal::theme()->render($callback, $variables);
- $this->verbose('Variables:' . '' . String::checkPlain(var_export($variables, TRUE)) . '
'
- . '
' . 'Result:' . '' . String::checkPlain(var_export($output, TRUE)) . '
'
- . '
' . 'Expected:' . '' . String::checkPlain(var_export($expected, TRUE)) . '
'
- . '
' . $output
- );
if (!$message) {
$message = '%callback rendered correctly.';
}
diff --git a/core/modules/system/src/Controller/DbUpdateController.php b/core/modules/system/src/Controller/DbUpdateController.php
index 2a7992c..fdd9f71 100644
--- a/core/modules/system/src/Controller/DbUpdateController.php
+++ b/core/modules/system/src/Controller/DbUpdateController.php
@@ -348,7 +348,8 @@ protected function selection() {
'#title' => $this->t('Apply pending updates'),
'#attributes' => array('class' => array('button', 'button--primary')),
'#weight' => 5,
- ) + $url->toRenderArray();
+ '#url' => $url,
+ );
}
return $build;
@@ -621,12 +622,12 @@ public static function batchFinished($success, $results, $operations) {
protected function helpfulLinks() {
$links['front'] = array(
'title' => $this->t('Front page'),
- 'route_name' => '',
+ 'url' => Url::fromRoute(''),
);
if ($this->account->hasPermission('access administration pages')) {
$links['admin-pages'] = array(
'title' => $this->t('Administration pages'),
- 'route_name' => 'system.admin',
+ 'url' => Url::fromRoute('system.admin'),
);
}
return $links;
diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php
index 43ab34e..d634dd7 100644
--- a/core/modules/system/src/Controller/SystemController.php
+++ b/core/modules/system/src/Controller/SystemController.php
@@ -15,6 +15,7 @@
use Drupal\Core\Menu\MenuLinkTreeInterface;
use Drupal\Core\Menu\MenuTreeParameters;
use Drupal\Core\Theme\ThemeAccessCheck;
+use Drupal\Core\Url;
use Drupal\system\SystemManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -242,8 +243,7 @@ public function themesPage() {
if ($this->themeAccess->checkAccess($theme->getName())) {
$theme->operations[] = array(
'title' => $this->t('Settings'),
- 'route_name' => 'system.theme_settings_theme',
- 'route_parameters' => array('theme' => $theme->getName()),
+ 'url' => Url::fromRoute('system.theme_settings_theme', ['theme' => $theme->getName()]),
'attributes' => array('title' => $this->t('Settings for !theme theme', array('!theme' => $theme->info['name']))),
);
}
@@ -252,14 +252,14 @@ public function themesPage() {
if ($theme->getName() != $admin_theme) {
$theme->operations[] = array(
'title' => $this->t('Uninstall'),
- 'route_name' => 'system.theme_uninstall',
+ 'url' => Url::fromRoute('system.theme_uninstall'),
'query' => $query,
'attributes' => array('title' => $this->t('Uninstall !theme theme', array('!theme' => $theme->info['name']))),
);
}
$theme->operations[] = array(
'title' => $this->t('Set as default'),
- 'route_name' => 'system.theme_set_default',
+ 'url' => Url::fromRoute('system.theme_set_default'),
'query' => $query,
'attributes' => array('title' => $this->t('Set !theme as default theme', array('!theme' => $theme->info['name']))),
);
@@ -269,13 +269,13 @@ public function themesPage() {
else {
$theme->operations[] = array(
'title' => $this->t('Install'),
- 'route_name' => 'system.theme_install',
+ 'url' => Url::fromRoute('system.theme_install'),
'query' => $query,
'attributes' => array('title' => $this->t('Install !theme theme', array('!theme' => $theme->info['name']))),
);
$theme->operations[] = array(
'title' => $this->t('Install and set as default'),
- 'route_name' => 'system.theme_set_default',
+ 'url' => Url::fromRoute('system.theme_set_default'),
'query' => $query,
'attributes' => array('title' => $this->t('Install !theme as default theme', array('!theme' => $theme->info['name']))),
);
diff --git a/core/modules/system/src/Tests/Common/RenderWebTest.php b/core/modules/system/src/Tests/Common/RenderWebTest.php
index 5d7f36e..c2136dd 100644
--- a/core/modules/system/src/Tests/Common/RenderWebTest.php
+++ b/core/modules/system/src/Tests/Common/RenderWebTest.php
@@ -147,12 +147,7 @@ function testDrupalRenderFormElements() {
* Tests that elements are rendered properly.
*/
protected function assertRenderedElement(array $element, $xpath, array $xpath_args = array()) {
- $original_element = $element;
$this->drupalSetContent(drupal_render($element));
- $this->verbose('' . String::checkPlain(var_export($original_element, TRUE)) . '
'
- . '' . String::checkPlain(var_export($element, TRUE)) . '
'
- . '
' . $this->drupalGetContent()
- );
// @see \Drupal\simpletest\WebTestBase::xpath()
$xpath = $this->buildXPathQuery($xpath, $xpath_args);
diff --git a/core/modules/system/src/Tests/Common/UrlTest.php b/core/modules/system/src/Tests/Common/UrlTest.php
index 01470a9..488c31b 100644
--- a/core/modules/system/src/Tests/Common/UrlTest.php
+++ b/core/modules/system/src/Tests/Common/UrlTest.php
@@ -118,7 +118,7 @@ function testLinkAttributes() {
$type_link = array(
'#type' => 'link',
'#title' => $this->randomMachineName(),
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
'#options' => array(
'attributes' => array(
'class' => array($class_theme),
diff --git a/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php
index d04fa45..9eeeb47 100644
--- a/core/modules/system/src/Tests/Theme/FunctionsTest.php
+++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php
@@ -10,6 +10,7 @@
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\String;
use Drupal\Core\Session\UserSession;
+use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
/**
@@ -193,17 +194,15 @@ function testLinks() {
),
'front page' => array(
'title' => 'Front page',
- 'route_name' => '',
+ 'url' => Url::fromRoute(''),
),
'router-test' => array(
'title' => 'Test route',
- 'route_name' => 'router_test.1',
- 'route_parameters' => array(),
+ 'url' => Url::fromRoute('router_test.1'),
),
'query-test' => array(
'title' => 'Query test route',
- 'route_name' => 'router_test.1',
- 'route_parameters' => array(),
+ 'url' => Url::fromRoute('router_test.1'),
'query' => array(
'key' => 'value',
)
@@ -287,7 +286,7 @@ function testDrupalPreRenderLinks() {
'#links' => array(
'parent_link' => array(
'title' => 'Parent link original',
- 'route_name' => 'router_test.1',
+ 'url' => Url::fromRoute('router_test.1'),
),
),
'first_child' => array(
@@ -298,12 +297,12 @@ function testDrupalPreRenderLinks() {
// one of the parent's links).
'parent_link' => array(
'title' => 'Parent link copy',
- 'route_name' => 'router_test.6',
+ 'url' => Url::fromRoute('router_test.6'),
),
// This should always be rendered.
'first_child_link' => array(
'title' => 'First child link',
- 'route_name' => 'router_test.7',
+ 'url' => Url::fromRoute('router_test.7'),
),
),
),
@@ -313,7 +312,7 @@ function testDrupalPreRenderLinks() {
'#links' => array(
'second_child_link' => array(
'title' => 'Second child link',
- 'route_name' => 'router_test.8',
+ 'url' => Url::fromRoute('router_test.8'),
),
),
),
@@ -324,7 +323,7 @@ function testDrupalPreRenderLinks() {
'#links' => array(
'third_child_link' => array(
'title' => 'Third child link',
- 'route_name' => 'router_test.9',
+ 'url' => Url::fromRoute('router_test.9'),
),
),
'#access' => FALSE,
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 0c569c4..f27bc0e 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -412,12 +412,12 @@ function hook_menu_local_tasks(&$data, $route_name) {
'#theme' => 'menu_local_action',
'#link' => array(
'title' => t('Add content'),
- 'url' => Url::fromRoute('node.add_page', array(
+ 'url' => Url::fromRoute('node.add_page'),
+ 'localized_options' => array(
'attributes' => array(
'title' => t('Add content'),
),
- )),
- 'localized_options' => ,
+ ),
),
);
@@ -426,7 +426,7 @@ function hook_menu_local_tasks(&$data, $route_name) {
'#theme' => 'menu_local_task',
'#link' => array(
'title' => t('Example tab'),
- 'route_name' => 'node.add_page',
+ 'url' => Url::fromRoute('node.add_page'),
'localized_options' => array(
'attributes' => array(
'title' => t('Add content'),
@@ -2277,7 +2277,7 @@ function hook_system_themes_page_alter(&$theme_groups) {
// Add a foo link to each list of theme operations.
$theme->operations[] = array(
'title' => t('Foo'),
- 'route_name' => 'system.themes_page',
+ 'url' => Url::fromRoute('system.themes_page'),
'query' => array('theme' => $theme->getName())
);
}
diff --git a/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php b/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php
index d99a896..cf82dba 100644
--- a/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php
+++ b/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php
@@ -26,7 +26,7 @@ public function typeLinkActiveClass() {
'no_query' => array(
'#type' => 'link',
'#title' => t('Link with no query string'),
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
'#options' => array(
'set_active_class' => TRUE,
),
@@ -34,7 +34,7 @@ public function typeLinkActiveClass() {
'with_query' => array(
'#type' => 'link',
'#title' => t('Link with a query string'),
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
'#options' => array(
'query' => array(
'foo' => 'bar',
@@ -46,7 +46,7 @@ public function typeLinkActiveClass() {
'with_query_reversed' => array(
'#type' => 'link',
'#title' => t('Link with the same query string in reverse order'),
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
'#options' => array(
'query' => array(
'one' => 'two',
diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php
index ffe0ea1..65ed68a 100644
--- a/core/modules/taxonomy/src/Form/OverviewTerms.php
+++ b/core/modules/taxonomy/src/Form/OverviewTerms.php
@@ -269,17 +269,20 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
'edit' => array(
'title' => $this->t('Edit'),
'query' => $destination,
- ) + $term->urlInfo('edit-form')->toArray(),
+ 'url' => $term->urlInfo('edit-form'),
+ ),
'delete' => array(
'title' => $this->t('Delete'),
'query' => $destination,
- ) + $term->urlInfo('delete-form')->toArray(),
+ 'url' => $term->urlInfo('delete-form'),
+ ),
);
if ($this->moduleHandler->moduleExists('content_translation') && content_translation_translate_access($term)->isAllowed()) {
$operations['translate'] = array(
'title' => $this->t('Translate'),
'query' => $destination,
- ) + $term->urlInfo('drupal:content-translation-overview')->toArray();
+ 'url' => $term->urlInfo('drupal:content-translation-overview'),
+ );
}
$form['terms'][$key]['operations'] = array(
'#type' => 'operations',
diff --git a/core/modules/taxonomy/src/VocabularyListBuilder.php b/core/modules/taxonomy/src/VocabularyListBuilder.php
index a5a02fc..bb385df 100644
--- a/core/modules/taxonomy/src/VocabularyListBuilder.php
+++ b/core/modules/taxonomy/src/VocabularyListBuilder.php
@@ -43,11 +43,13 @@ public function getDefaultOperations(EntityInterface $entity) {
$operations['list'] = array(
'title' => t('List terms'),
'weight' => 0,
- ) + $entity->urlInfo('overview-form')->toArray();
+ 'url' => $entity->urlInfo('overview-form'),
+ );
$operations['add'] = array(
'title' => t('Add terms'),
'weight' => 10,
- ) + $entity->urlInfo('add-form')->toArray();
+ 'url' => $entity->urlInfo('add-form'),
+ );
unset($operations['delete']);
return $operations;
diff --git a/core/modules/user/src/RoleListBuilder.php b/core/modules/user/src/RoleListBuilder.php
index 8e7feec..4e0dd73 100644
--- a/core/modules/user/src/RoleListBuilder.php
+++ b/core/modules/user/src/RoleListBuilder.php
@@ -51,7 +51,8 @@ public function getDefaultOperations(EntityInterface $entity) {
$operations['permissions'] = array(
'title' => t('Edit permissions'),
'weight' => 20,
- ) + $entity->urlInfo('edit-permissions-form')->toArray();
+ 'url' => $entity->urlInfo('edit-permissions-form'),
+ );
}
return $operations;
}
diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc
index 02f0175..f089f56 100644
--- a/core/modules/views/views.theme.inc
+++ b/core/modules/views/views.theme.inc
@@ -1049,7 +1049,7 @@ function template_preprocess_views_mini_pager(&$variables) {
$li_previous = array(
'#type' => 'link',
'#title' => $tags[1],
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
'#options' => array(
'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1),
'attributes' => array(
@@ -1072,7 +1072,7 @@ function template_preprocess_views_mini_pager(&$variables) {
$li_next = array(
'#type' => 'link',
'#title' => $tags[3],
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
'#options' => array(
'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1),
'attributes' => array(
diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php
index 2ca0dca..3b82ebe 100644
--- a/core/modules/views_ui/src/ViewEditForm.php
+++ b/core/modules/views_ui/src/ViewEditForm.php
@@ -705,7 +705,8 @@ public function renderDisplayTop(ViewUI $view) {
),
'duplicate' => array(
'title' => $this->t('Duplicate view'),
- ) + $view->urlInfo('duplicate-form')->toArray(),
+ 'url' => $view->urlInfo('duplicate-form'),
+ ),
'reorder' => array(
'title' => $this->t('Reorder displays'),
'url' => Url::fromRoute('views_ui.form_reorder_displays', ['js' => 'nojs', 'view' => $view->id(), 'display_id' => $display_id]),
@@ -717,7 +718,8 @@ public function renderDisplayTop(ViewUI $view) {
if ($view->access('delete')) {
$element['extra_actions']['#links']['delete'] = array(
'title' => $this->t('Delete view'),
- ) + $view->urlInfo('delete-form')->toArray();
+ 'url' => $view->urlInfo('delete-form'),
+ );
}
// Let other modules add additional links here.
diff --git a/core/modules/views_ui/src/ViewFormBase.php b/core/modules/views_ui/src/ViewFormBase.php
index 9544040..39f1a0d 100644
--- a/core/modules/views_ui/src/ViewFormBase.php
+++ b/core/modules/views_ui/src/ViewFormBase.php
@@ -122,9 +122,9 @@ public function getDisplayTabs(ViewUI $view) {
'#link' => array(
'title' => $this->getDisplayLabel($view, $id),
'localized_options' => array(),
- ) + $view->urlInfo('edit-display-form')->toArray(),
+ 'url' => $view->urlInfo('edit-display-form')->setRouteParameter('display_id', $id),
+ ),
);
- $tabs[$id]['#link']['route_parameters']['display_id'] = $id;
if (!empty($display['deleted'])) {
$tabs[$id]['#link']['localized_options']['attributes']['class'][] = 'views-display-deleted-link';
}
diff --git a/core/modules/views_ui/src/ViewListBuilder.php b/core/modules/views_ui/src/ViewListBuilder.php
index 9d12e5a..c8dcbe1 100644
--- a/core/modules/views_ui/src/ViewListBuilder.php
+++ b/core/modules/views_ui/src/ViewListBuilder.php
@@ -149,15 +149,14 @@ public function getDefaultOperations(EntityInterface $entity) {
$operations['duplicate'] = array(
'title' => $this->t('Duplicate'),
'weight' => 15,
- ) + $entity->urlInfo('duplicate-form')->toArray();
+ 'url' => $entity->urlInfo('duplicate-form'),
+ );
}
// Add AJAX functionality to enable/disable operations.
foreach (array('enable', 'disable') as $op) {
if (isset($operations[$op])) {
- $operations[$op]['route_name'] = "entity.view.{$op}";
- $operations[$op]['route_parameters'] = array('view' => $entity->id());
-
+ $operations[$op]['url'] = $entity->urlInfo($op);
// Enable and disable operations should use AJAX.
$operations[$op]['attributes']['class'][] = 'use-ajax';
}
diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module
index ca61352..b6e92b6 100644
--- a/core/modules/views_ui/views_ui.module
+++ b/core/modules/views_ui/views_ui.module
@@ -253,8 +253,8 @@ function views_ui_contextual_links_view_alter(&$element, $items) {
// screen.
elseif (!empty($element['#links']['entityviewedit-form'])) {
$display_id = $items['entity.view.edit_form']['metadata']['display_id'];
- $element['#links']['entityviewedit-form']['route_parameters']['display_id'] = $display_id;
- $element['#links']['entityviewedit-form']['route_name'] = 'entity.view.edit_display_form';
+ $route_parameters = $element['#links']['entityviewedit-form']['url']->getRouteParameters() + ['display_id' => $display_id];
+ $element['#links']['entityviewedit-form']['url'] = Url::fromRoute('entity.view.edit_display_form', $route_parameters);
}
}
diff --git a/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php b/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php
index 842304c..b80567f 100644
--- a/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php
@@ -56,16 +56,7 @@ public function testCancelLinkRoute() {
* Tests a cancel link route with parameters.
*/
public function testCancelLinkRouteWithParams() {
- $cancel_route = array(
- 'route_name' => 'foo_bar.baz',
- 'route_parameters' => array(
- 'baz' => 'banana',
- ),
- 'options' => array(
- 'absolute' => TRUE,
- ),
- );
- $expected = Url::fromRoute($cancel_route['route_name'], $cancel_route['route_parameters'], $cancel_route['options']);
+ $expected = Url::fromRoute('foo_bar.baz', ['baz' => 'banana'], ['absolute' => TRUE]);
$form = $this->getMock('Drupal\Core\Form\ConfirmFormInterface');
$form->expects($this->any())
->method('getCancelUrl')
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
index 1942fc3..219ef03 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
@@ -16,6 +16,7 @@
use Drupal\Core\Menu\LocalActionManager;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\Url;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -196,8 +197,7 @@ public function getActionsForRouteProvider() {
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 1',
- 'route_name' => 'test_route_2',
- 'route_parameters' => array(),
+ 'url' => Url::fromRoute('test_route_2'),
'localized_options' => '',
),
'#access' => FALSE,
@@ -231,8 +231,7 @@ public function getActionsForRouteProvider() {
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 1',
- 'route_name' => 'test_route_2',
- 'route_parameters' => array(),
+ 'url' => Url::fromRoute('test_route_2'),
'localized_options' => '',
),
'#access' => FALSE,
@@ -267,8 +266,7 @@ public function getActionsForRouteProvider() {
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 1',
- 'route_name' => 'test_route_2',
- 'route_parameters' => array(),
+ 'url' => Url::fromRoute('test_route_2'),
'localized_options' => '',
),
'#access' => FALSE,
@@ -278,8 +276,7 @@ public function getActionsForRouteProvider() {
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 2',
- 'route_name' => 'test_route_3',
- 'route_parameters' => array(),
+ 'url' => Url::fromRoute('test_route_3'),
'localized_options' => '',
),
'#access' => FALSE,
@@ -316,8 +313,7 @@ public function getActionsForRouteProvider() {
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 1',
- 'route_name' => 'test_route_2',
- 'route_parameters' => array('test1'),
+ 'url' => Url::fromRoute('test_route_2', ['test1']),
'localized_options' => '',
),
'#access' => FALSE,
@@ -327,8 +323,7 @@ public function getActionsForRouteProvider() {
'#theme' => 'menu_local_action',
'#link' => array(
'title' => 'Plugin ID 2',
- 'route_name' => 'test_route_2',
- 'route_parameters' => array('test2'),
+ 'url' => Url::fromRoute('test_route_2', ['test2']),
'localized_options' => '',
),
'#access' => FALSE,
diff --git a/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
index 9d6ea00..fcc1613 100644
--- a/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
@@ -146,17 +146,13 @@ public function testToString(array $urls) {
* @covers ::toArray
*/
public function testToArray(array $urls) {
- $expected = array(
- 'path' => $this->unroutedExternal,
- 'options' => array('external' => TRUE),
- );
- $this->assertSame($expected, $urls[0]->toArray());
+ $expected = Url::fromUri($this->unroutedExternal, array('external' => TRUE));
+ $expected->setUnroutedUrlAssembler(\Drupal::service('unrouted_url_assembler'));
+ $this->assertEquals($expected, $urls[0]);
- $expected = array(
- 'path' => $this->unroutedInternal,
- 'options' => array(),
- );
- $this->assertSame($expected, $urls[1]->toArray());
+ $expected = Url::fromUri($this->unroutedInternal, array());
+ $expected->setUnroutedUrlAssembler(\Drupal::service('unrouted_url_assembler'));
+ $this->assertEquals($expected, $urls[1]);
}
/**
diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php
index 75c4768..404702e 100644
--- a/core/tests/Drupal/Tests/Core/UrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UrlTest.php
@@ -102,7 +102,8 @@ public function testUrlFromRequest() {
foreach ($this->map as $index => $values) {
$path = array_pop($values);
$url = Url::createFromRequest(Request::create("$path"));
- $this->assertSame($values, array_values($url->toArray()));
+ $expected = Url::fromRoute($values[0], $values[1], $values[2]);
+ $this->assertEquals($expected, $url);
$urls[$index] = $url;
}
return $urls;
@@ -245,12 +246,9 @@ public function testToString($urls) {
*/
public function testToArray($urls) {
foreach ($urls as $index => $url) {
- $expected = array(
- 'route_name' => $this->map[$index][0],
- 'route_parameters' => $this->map[$index][1],
- 'options' => $this->map[$index][2],
- );
- $this->assertSame($expected, $url->toArray());
+ $expected = Url::fromRoute($this->map[$index][0], $this->map[$index][1], $this->map[$index][2]);
+ $expected->setUrlGenerator(\Drupal::urlGenerator());
+ $this->assertEquals($expected, $url);
}
}