'),
'attributes' => array(
'class' => 'hidden',
'title' => $this->t('Jump to the first new comment of this posting.'),
@@ -136,15 +137,14 @@ public function buildCommentedEntityLinks(ContentEntityInterface $entity, array
'fragment' => 'comment-form',
);
if ($comment_form_location == CommentItemInterface::FORM_SEPARATE_PAGE) {
- $links['comment-add']['route_name'] = 'comment.reply';
- $links['comment-add']['route_parameters'] = array(
+ $links['comment-add']['url'] = Url::fromRoute('comment.reply', [
'entity_type' => $entity->getEntityTypeId(),
'entity' => $entity->id(),
'field_name' => $field_name,
- );
+ ]);
}
else {
- $links['comment-add'] += $entity->urlInfo()->toArray();
+ $links['comment-add'] += ['url' => $entity->urlInfo()];
}
}
elseif ($this->currentUser->isAnonymous()) {
@@ -171,12 +171,11 @@ public function buildCommentedEntityLinks(ContentEntityInterface $entity, array
'fragment' => 'comment-form',
);
if ($comment_form_location == CommentItemInterface::FORM_SEPARATE_PAGE) {
- $links['comment-add']['route_name'] = 'comment.reply';
- $links['comment-add']['route_parameters'] = array(
+ $links['comment-add']['url'] = Url::fromRoute('comment.reply', [
'entity_type' => $entity->getEntityTypeId(),
'entity' => $entity->id(),
'field_name' => $field_name,
- );
+ ]);
}
else {
$links['comment-add'] += $entity->urlInfo()->toArray();
diff --git a/core/modules/comment/src/CommentViewBuilder.php b/core/modules/comment/src/CommentViewBuilder.php
index da9ebbc..09399bf 100644
--- a/core/modules/comment/src/CommentViewBuilder.php
+++ b/core/modules/comment/src/CommentViewBuilder.php
@@ -17,6 +17,7 @@
use Drupal\Core\Entity\EntityViewBuilder;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -261,21 +262,19 @@ protected static function buildLinks(CommentInterface $entity, EntityInterface $
if ($entity->access('create')) {
$links['comment-reply'] = array(
'title' => t('Reply'),
- 'route_name' => 'comment.reply',
- 'route_parameters' => [
+ 'url' => Url::fromRoute('comment.reply', [
'entity_type' => $entity->getCommentedEntityTypeId(),
'entity' => $entity->getCommentedEntityId(),
'field_name' => $entity->getFieldName(),
'pid' => $entity->id(),
- ],
+ ]),
'html' => TRUE,
);
}
if (!$entity->isPublished() && $entity->access('approve')) {
$links['comment-approve'] = array(
'title' => t('Approve'),
- 'route_name' => 'comment.approve',
- 'route_parameters' => array('comment' => $entity->id()),
+ 'url' => Url::fromRoute('comment.approve', ['comment' => $entity->id()]),
'html' => TRUE,
);
}
diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php
index 68311d7..c68f54b 100644
--- a/core/modules/comment/src/Form/CommentAdminOverview.php
+++ b/core/modules/comment/src/Form/CommentAdminOverview.php
@@ -15,6 +15,7 @@
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -217,18 +218,12 @@ public function buildForm(array $form, FormStateInterface $form_state, $type = '
$links = array();
$links['edit'] = array(
'title' => $this->t('Edit'),
- 'route_name' => 'entity.comment.edit_form',
- 'route_parameters' => array('comment' => $comment->id()),
- 'options' => $comment_uri_options,
- 'query' => $destination,
+ 'url' => Url::fromRoute('entity.comment.edit_form', ['comment' => $comment->id()], $comment_uri_options + ['query' => $destination]),
);
if ($this->moduleHandler->moduleExists('content_translation') && $this->moduleHandler->invoke('content_translation', 'translate_access', array($comment))->isAllowed()) {
$links['translate'] = array(
'title' => $this->t('Translate'),
- 'route_name' => 'content_translation.translation_overview_comment',
- 'route_parameters' => array('comment' => $comment->id()),
- 'options' => $comment_uri_options,
- 'query' => $destination,
+ 'url' => Url::fromRoute('content_translation.translation_overview_comment', ['comment' => $comment->id()], $comment_uri_options + ['query' => $destination]),
);
}
$options[$comment->id()]['operations']['data'] = array(
diff --git a/core/modules/comment/tests/modules/comment_test/comment_test.module b/core/modules/comment/tests/modules/comment_test/comment_test.module
index 64ee3ad..797a5fd 100644
--- a/core/modules/comment/tests/modules/comment_test/comment_test.module
+++ b/core/modules/comment/tests/modules/comment_test/comment_test.module
@@ -7,6 +7,7 @@
*/
use Drupal\comment\CommentInterface;
+use Drupal\Core\Url;
/**
* Implements hook_entity_type_alter().
@@ -36,10 +37,8 @@ function comment_test_comment_links_alter(array &$links, CommentInterface &$enti
'#links' => array(
'comment-report' => array(
'title' => t('Report'),
- 'route_name' => 'comment_test.report',
- 'route_parameters' => ['comment' => $entity->id()],
+ 'url' => Url::fromRoute('comment_test.report', ['comment' => $entity->id()], ['query' => array('token' => \Drupal::getContainer()->get('csrf_token')->get("comment/{$entity->id()}/report"))]),
'html' => TRUE,
- 'query' => array('token' => \Drupal::getContainer()->get('csrf_token')->get("comment/{$entity->id()}/report")),
),
),
);
diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
index 2993f28..25d5c3c 100644
--- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
@@ -9,6 +9,7 @@
use Drupal\comment\CommentLinkBuilder;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
+use Drupal\Core\Url;
use Drupal\node\NodeInterface;
use Drupal\simpletest\TestBase;
use Drupal\Tests\UnitTestCase;
@@ -236,11 +237,11 @@ public function getLinkCombinations() {
$expected['comment-add'] = array('title' => 'Add new comment');
if ($combination['form_location'] == CommentItemInterface::FORM_BELOW) {
// On the same page.
- $expected['comment-add']['route_name'] = 'node.view';
+ $expected['comment-add']['url'] = Url::fromRoute('node.view');
}
else {
// On a separate page.
- $expected['comment-add']['route_name'] = 'comment.reply';
+ $expected['comment-add']['url'] = Url::fromRoute('comment.reply');
}
}
}
diff --git a/core/modules/config/src/Form/ConfigSync.php b/core/modules/config/src/Form/ConfigSync.php
index 16bceed..b026e6f 100644
--- a/core/modules/config/src/Form/ConfigSync.php
+++ b/core/modules/config/src/Form/ConfigSync.php
@@ -20,6 +20,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Lock\LockBackendInterface;
use Drupal\Core\Config\StorageComparer;
+use Drupal\Core\Url;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -264,8 +265,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
}
$links['view_diff'] = array(
'title' => $this->t('View differences'),
- 'route_name' => $route_name,
- 'route_parameters' => $route_options,
+ 'url' => Url::fromRoute($route_name, $route_options),
'attributes' => array(
'class' => array('use-ajax'),
'data-accepts' => 'application/vnd.drupal-modal',
diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php
index 9265d33..2cbc78e 100644
--- a/core/modules/config_translation/src/ConfigEntityMapper.php
+++ b/core/modules/config_translation/src/ConfigEntityMapper.php
@@ -13,6 +13,7 @@
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
+use Drupal\Core\Url;
use Drupal\locale\LocaleConfigManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -216,10 +217,9 @@ public function getOperations() {
return array(
'list' => array(
'title' => $this->t('List'),
- 'route_name' => 'config_translation.entity_list',
- 'route_parameters' => [
+ 'url' => Url::fromRoute('config_translation.entity_list', [
'mapper_id' => $this->getPluginId(),
- ],
+ ]),
),
);
}
diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationController.php b/core/modules/config_translation/src/Controller/ConfigTranslationController.php
index 646d3b8..b6b016c 100644
--- a/core/modules/config_translation/src/Controller/ConfigTranslationController.php
+++ b/core/modules/config_translation/src/Controller/ConfigTranslationController.php
@@ -15,6 +15,7 @@
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
@@ -174,9 +175,7 @@ public function itemPage(Request $request, RouteMatchInterface $route_match, $pl
if ($edit_access) {
$operations['edit'] = array(
'title' => $this->t('Edit'),
- 'route_name' => $mapper->getBaseRouteName(),
- 'route_parameters' => $mapper->getBaseRouteParameters(),
- 'query' => array('destination' => $mapper->getOverviewPath()),
+ 'url' => Url::fromRoute($mapper->getBaseRouteName(), $mapper->getBaseRouteParameters(), ['query' => ['destination' => $mapper->getOverviewPath()]]),
);
}
}
@@ -188,22 +187,19 @@ public function itemPage(Request $request, RouteMatchInterface $route_match, $pl
if (!$mapper->hasTranslation($language)) {
$operations['add'] = array(
'title' => $this->t('Add'),
- 'route_name' => $mapper->getAddRouteName(),
- 'route_parameters' => $mapper->getAddRouteParameters(),
+ 'url' => Url::fromRoute($mapper->getAddRouteName(), $mapper->getAddRouteParameters()),
);
}
else {
// Otherwise, link to edit the existing translation.
$operations['edit'] = array(
'title' => $this->t('Edit'),
- 'route_name' => $mapper->getEditRouteName(),
- 'route_parameters' => $mapper->getEditRouteParameters(),
+ 'url' => Url::fromRoute($mapper->getEditRouteName(), $mapper->getEditRouteParameters()),
);
$operations['delete'] = array(
'title' => $this->t('Delete'),
- 'route_name' => $mapper->getDeleteRouteName(),
- 'route_parameters' => $mapper->getDeleteRouteParameters(),
+ 'url' => Url::fromRoute($mapper->getDeleteRouteName(), $mapper->getDeleteRouteParameters()),
);
}
}
diff --git a/core/modules/contextual/src/Element/ContextualLinks.php b/core/modules/contextual/src/Element/ContextualLinks.php
index 8aeec9f..3c95191 100644
--- a/core/modules/contextual/src/Element/ContextualLinks.php
+++ b/core/modules/contextual/src/Element/ContextualLinks.php
@@ -8,6 +8,7 @@
namespace Drupal\contextual\Element;
use Drupal\Core\Render\Element\RenderElement;
+use Drupal\Core\Url;
/**
* Provides a contextual_links element.
@@ -82,8 +83,7 @@ public static function preRenderLinks(array $element) {
$class = drupal_html_class($class);
$links[$class] = array(
'title' => $item['title'],
- 'route_name' => isset($item['route_name']) ? $item['route_name'] : '',
- 'route_parameters' => isset($item['route_parameters']) ? $item['route_parameters'] : array(),
+ 'url' => Url::fromRoute(isset($item['route_name']) ? $item['route_name'] : '', isset($item['route_parameters']) ? $item['route_parameters'] : array()),
);
}
$element['#links'] = $links;
diff --git a/core/modules/field_ui/src/FieldOverview.php b/core/modules/field_ui/src/FieldOverview.php
index 0e42fcd..838c116 100644
--- a/core/modules/field_ui/src/FieldOverview.php
+++ b/core/modules/field_ui/src/FieldOverview.php
@@ -14,6 +14,7 @@
use Drupal\Core\Field\FieldTypePluginManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
+use Drupal\Core\Url;
use Drupal\field_ui\OverviewBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\field\Entity\FieldStorageConfig;
@@ -135,8 +136,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $entity_t
'type' => array(
'#type' => 'link',
'#title' => $field_types[$field_storage->getType()]['label'],
- '#route_name' => 'field_ui.storage_edit_' . $this->entity_type,
- '#route_parameters' => $route_parameters,
+ '#url' => Url::fromRoute('field_ui.storage_edit_' . $this->entity_type, $route_parameters),
'#options' => array('attributes' => array('title' => $this->t('Edit field settings.'))),
),
);
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index bd4da4e..aa8dfc5 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -52,8 +52,7 @@ function forum_help($route_name, RouteMatchInterface $route_match) {
$output = '' . t('Forums contain forum topics. Use containers to group related forums.') . '
';
$more_help_link = array(
'#type' => 'link',
- '#route_name' => 'help.page',
- '#route_parameters' => array('name' => 'forum'),
+ '#url' => Url::fromRoute('help.page', ['name' => 'forum']),
'#title' => t('More help'),
);
$container = array(
@@ -118,8 +117,7 @@ function forum_menu_local_tasks(&$data, $route_name) {
'#theme' => 'menu_local_action',
'#link' => array(
'title' => t('Add new @node_type', array('@node_type' => entity_load('node_type', $type)->label())),
- 'route_name' => 'node.add',
- 'route_parameters' => ['node_type' => $type],
+ 'url' => Url::fromRoute('node.add', ['node_type' => $type]),
),
);
if ($forum_term && $forum_term->bundle() == $vid) {
diff --git a/core/modules/forum/src/Form/Overview.php b/core/modules/forum/src/Form/Overview.php
index d897881..ceaa4d3 100644
--- a/core/modules/forum/src/Form/Overview.php
+++ b/core/modules/forum/src/Form/Overview.php
@@ -70,14 +70,14 @@ public function buildForm(array $form, FormStateInterface $form_state) {
unset($form['terms'][$key]['operations']['#links']['delete']);
if (!empty($term->forum_container->value)) {
$form['terms'][$key]['operations']['#links']['edit']['title'] = $this->t('edit container');
- $form['terms'][$key]['operations']['#links']['edit']['route_name'] = 'forum.edit_container';
+ $form['terms'][$key]['operations']['#links']['edit']['url'] = Url::fromRoute('forum.edit_container');
// We don't want the redirect from the link so we can redirect the
// delete action.
unset($form['terms'][$key]['operations']['#links']['edit']['query']['destination']);
}
else {
$form['terms'][$key]['operations']['#links']['edit']['title'] = $this->t('edit forum');
- $form['terms'][$key]['operations']['#links']['edit']['route_name'] = 'forum.edit_forum';
+ $form['terms'][$key]['operations']['#links']['edit']['route_name'] = Url::fromRoute('forum.edit_forum');
// We don't want the redirect from the link so we can redirect the
// delete action.
unset($form['terms'][$key]['operations']['#links']['edit']['query']['destination']);
diff --git a/core/modules/forum/src/Plugin/Block/ForumBlockBase.php b/core/modules/forum/src/Plugin/Block/ForumBlockBase.php
index edd7ac6..17c3147 100644
--- a/core/modules/forum/src/Plugin/Block/ForumBlockBase.php
+++ b/core/modules/forum/src/Plugin/Block/ForumBlockBase.php
@@ -11,6 +11,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Cache\Cache;
+use Drupal\Core\Url;
/**
* Provides a base class for Forum blocks.
@@ -27,7 +28,7 @@ public function build() {
$elements['forum_list'] = $node_title_list;
$elements['forum_more'] = array(
'#type' => 'more_link',
- '#route_name' => 'forum.index',
+ '#url' => Url::fromRoute('forum.index'),
'#attributes' => array('title' => $this->t('Read the latest forum topics.')),
);
}
diff --git a/core/modules/image/src/Form/ImageStyleEditForm.php b/core/modules/image/src/Form/ImageStyleEditForm.php
index 1b28d7f..4edd31c 100644
--- a/core/modules/image/src/Form/ImageStyleEditForm.php
+++ b/core/modules/image/src/Form/ImageStyleEditForm.php
@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
use Drupal\image\ConfigurableImageEffectInterface;
use Drupal\image\ImageEffectManager;
use Drupal\Component\Utility\String;
@@ -126,20 +127,18 @@ public function form(array $form, FormStateInterface $form_state) {
if ($is_configurable) {
$links['edit'] = array(
'title' => $this->t('Edit'),
- 'route_name' => 'image.effect_edit_form',
- 'route_parameters' => [
+ 'url' => Url::fromRoute('image.effect_edit_form', [
'image_style' => $this->entity->id(),
'image_effect' => $key,
- ],
+ ]),
);
}
$links['delete'] = array(
'title' => $this->t('Delete'),
- 'route_name' => 'image.effect_delete',
- 'route_parameters' => [
+ 'url' => Url::fromRoute('image.effect_delete', [
'image_style' => $this->entity->id(),
'image_effect' => $key,
- ],
+ ]),
);
$form['effects'][$key]['operations'] = array(
'#type' => 'operations',
diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc
index b060d35..d7a0415 100644
--- a/core/modules/language/language.admin.inc
+++ b/core/modules/language/language.admin.inc
@@ -8,6 +8,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Render\Element;
use Drupal\Core\Template\Attribute;
+use Drupal\Core\Url;
/**
* Prepares variables for language negotiation configuration form.
@@ -113,8 +114,7 @@ function theme_language_negotiation_configure_browser_form_table($variables) {
$links = array();
$links['delete'] = array(
'title' => t('Delete'),
- 'route_name' => 'language.negotiation_browser_delete',
- 'route_parameters' => ['browser_langcode' => $key],
+ 'url' => Url::fromRoute('language.negotiation_browser_delete', ['browser_langcode' => $key]),
'attributes' => array(
'class' => array('image-style-link'),
),
diff --git a/core/modules/language/src/Form/NegotiationConfigureForm.php b/core/modules/language/src/Form/NegotiationConfigureForm.php
index 5b2b471..c7495e9 100644
--- a/core/modules/language/src/Form/NegotiationConfigureForm.php
+++ b/core/modules/language/src/Form/NegotiationConfigureForm.php
@@ -16,6 +16,7 @@
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
use Drupal\language\ConfigurableLanguageManagerInterface;
use Drupal\language\LanguageNegotiatorInterface;
use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSelected;
@@ -298,7 +299,7 @@ protected function configureFormTable(array &$form, $type) {
if (isset($method['config_route_name'])) {
$config_op['configure'] = array(
'title' => $this->t('Configure'),
- 'route_name' => $method['config_route_name'],
+ 'url' => Url::fromRoute($method['config_route_name']),
);
// If there is at least one operation enabled show the operation
// column.
diff --git a/core/modules/node/src/Controller/NodeController.php b/core/modules/node/src/Controller/NodeController.php
index 64fc4f6..27ee85d 100644
--- a/core/modules/node/src/Controller/NodeController.php
+++ b/core/modules/node/src/Controller/NodeController.php
@@ -184,16 +184,14 @@ public function revisionOverview(NodeInterface $node) {
if ($revert_permission) {
$links['revert'] = array(
'title' => $this->t('Revert'),
- 'route_name' => 'node.revision_revert_confirm',
- 'route_parameters' => array('node' => $node->id(), 'node_revision' => $vid),
+ 'url' => Url::fromRoute('node.revision_revert_confirm', array('node' => $node->id(), 'node_revision' => $vid)),
);
}
if ($delete_permission) {
$links['delete'] = array(
'title' => $this->t('Delete'),
- 'route_name' => 'node.revision_delete_confirm',
- 'route_parameters' => array('node' => $node->id(), 'node_revision' => $vid),
+ 'url' => Url::fromRoute('node.revision_delete_confirm', array('node' => $node->id(), 'node_revision' => $vid)),
);
}
diff --git a/core/modules/path/src/Controller/PathController.php b/core/modules/path/src/Controller/PathController.php
index 96dd34b..65c1eb4 100644
--- a/core/modules/path/src/Controller/PathController.php
+++ b/core/modules/path/src/Controller/PathController.php
@@ -10,6 +10,7 @@
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Path\AliasStorageInterface;
use Drupal\Core\Path\AliasManagerInterface;
+use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -87,19 +88,11 @@ public function adminOverview($keys) {
$operations = array();
$operations['edit'] = array(
'title' => $this->t('Edit'),
- 'route_name' => 'path.admin_edit',
- 'route_parameters' => array(
- 'pid' => $data->pid,
- ),
- 'query' => $destination,
+ 'url' => Url::fromRoute('path.admin_edit', ['pid' => $data->pid], ['query' => $destination]),
);
$operations['delete'] = array(
'title' => $this->t('Delete'),
- 'route_name' => 'path.delete',
- 'route_parameters' => array(
- 'pid' => $data->pid,
- ),
- 'query' => $destination,
+ 'url' => Url::fromRoute('path.delete', ['pid' => $data->pid], ['query' => $destination]);
);
$row['data']['operations'] = array(
'data' => array(
diff --git a/core/modules/search/src/SearchPageListBuilder.php b/core/modules/search/src/SearchPageListBuilder.php
index 5714f0a..4333064 100644
--- a/core/modules/search/src/SearchPageListBuilder.php
+++ b/core/modules/search/src/SearchPageListBuilder.php
@@ -14,6 +14,7 @@
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -118,7 +119,7 @@ public function buildRow(EntityInterface $entity) {
$row['url'] = array(
'#type' => 'link',
'#title' => $row['url'],
- '#route_name' => 'search.view_' . $entity->id(),
+ '#url' => Url::fromRoute('search.view_' . $entity->id()),
);
}
@@ -305,10 +306,9 @@ public function getDefaultOperations(EntityInterface $entity) {
else {
$operations['default'] = array(
'title' => $this->t('Set as default'),
- 'route_name' => 'entity.search_page.set_default',
- 'route_parameters' => array(
+ 'url' => Url::fromRoute('entity.search_page.set_default', array(
'search_page' => $entity->id(),
- ),
+ )),
'weight' => 50,
);
}
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index ba20e0b..8150bf2 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -343,8 +343,7 @@ function shortcut_preprocess_page(&$variables) {
'#prefix' => '',
'#type' => 'link',
'#title' => ''. $link_text .'',
- '#route_name' => $route_name,
- '#route_parameters' => $route_parameters,
+ '#url' => Url::fromRoute($route_name, $route_parameters),
'#options' => array('query' => $query, 'html' => TRUE),
'#suffix' => '
',
);
@@ -367,8 +366,7 @@ function shortcut_toolbar() {
$configure_link = array(
'#type' => 'link',
'#title' => t('Edit shortcuts'),
- '#route_name' => 'entity.shortcut_set.customize_form',
- '#route_parameters' => array('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/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php
index b24f8ca..aaf73eb 100644
--- a/core/modules/system/src/Form/ModulesListForm.php
+++ b/core/modules/system/src/Form/ModulesListForm.php
@@ -302,8 +302,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
$row['links']['configure'] = array(
'#type' => 'link',
'#title' => $this->t('Configure'),
- '#route_name' => $module->info['configure'],
- '#route_parameters' => $route_parameters,
+ '#url' => Url::fromRoute($module->info['configure'], $route_parameters),
'#options' => array(
'attributes' => array(
'class' => array('module-link', 'module-link-configure'),
diff --git a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php b/core/modules/system/src/Tests/Common/RenderElementTypesTest.php
index 73879ee..f3f27ab 100644
--- a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php
+++ b/core/modules/system/src/Tests/Common/RenderElementTypesTest.php
@@ -146,7 +146,7 @@ function testMoreLink() {
'name' => "#type 'more_link' anchor tag with a relative path",
'value' => array(
'#type' => 'more_link',
- '#route_name' => 'router_test.1',
+ '#url' => Url::fromRoute('router_test.1'),
),
'expected' => '//div[@class="more-link"]/a[@href="' . _url('router_test/test1') . '" and text()="More"]',
),
@@ -154,8 +154,7 @@ function testMoreLink() {
'name' => "#type 'more_link' anchor tag with a route",
'value' => array(
'#type' => 'more_link',
- '#route_name' => 'router_test.1',
- '#route_parameters' => array(),
+ '#url' => Url::fromRoute('router_test.1'),
),
'expected' => '//div[@class="more-link"]/a[@href="' . \Drupal::urlGenerator()->generate('router_test.1') . '" and text()="More"]',
),
@@ -163,7 +162,7 @@ function testMoreLink() {
'name' => "#type 'more_link' anchor tag with an absolute path",
'value' => array(
'#type' => 'more_link',
- '#route_name' => 'system.admin_content',
+ '#url' => Url::fromRoute('system.admin_content'),
'#options' => array('absolute' => TRUE),
),
'expected' => '//div[@class="more-link"]/a[@href="' . _url('admin/content', array('absolute' => TRUE)) . '" and text()="More"]',
@@ -172,7 +171,7 @@ function testMoreLink() {
'name' => "#type 'more_link' anchor tag to the front page",
'value' => array(
'#type' => 'more_link',
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
),
'expected' => '//div[@class="more-link"]/a[@href="' . _url('') . '" and text()="More"]',
),
diff --git a/core/modules/system/src/Tests/Common/RenderWebTest.php b/core/modules/system/src/Tests/Common/RenderWebTest.php
index 5e44ec0..5d7f36e 100644
--- a/core/modules/system/src/Tests/Common/RenderWebTest.php
+++ b/core/modules/system/src/Tests/Common/RenderWebTest.php
@@ -106,7 +106,7 @@ function testDrupalRenderFormElements() {
$element = array(
'#type' => 'link',
'#title' => $this->randomMachineName(),
- '#route_name' => 'common_test.destination',
+ '#url' => Url::fromRoute('common_test.destination'),
'#options' => array(
'absolute' => TRUE,
),
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index c872f4b..0c569c4 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'),
- 'route_name' => 'node.add_page',
- 'localized_options' => array(
+ 'url' => Url::fromRoute('node.add_page', array(
'attributes' => array(
'title' => t('Add content'),
),
- ),
+ )),
+ 'localized_options' => ,
),
);
diff --git a/core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php b/core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php
index 7d2cb79..b4e4393 100644
--- a/core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php
+++ b/core/modules/system/tests/modules/theme_test/src/EventSubscriber/ThemeTestSubscriber.php
@@ -7,6 +7,7 @@
namespace Drupal\theme_test\EventSubscriber;
+use Drupal\Core\Url;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -44,7 +45,7 @@ public function onRequest(GetResponseEvent $event) {
// returning output and theming the page as a whole.
$more_link = array(
'#type' => 'more_link',
- '#route_name' => 'user.page',
+ '#url' => Url::fromRoute('user.page'),
'#attributes' => array('title' => 'Themed output generated in a KernelEvents::REQUEST listener'),
);
$GLOBALS['theme_test_output'] = drupal_render($more_link);
diff --git a/core/modules/toolbar/src/Element/ToolbarItem.php b/core/modules/toolbar/src/Element/ToolbarItem.php
index e1249b9..29efe32 100644
--- a/core/modules/toolbar/src/Element/ToolbarItem.php
+++ b/core/modules/toolbar/src/Element/ToolbarItem.php
@@ -9,6 +9,7 @@
use Drupal\Component\Utility\Html;
use Drupal\Core\Render\Element\RenderElement;
+use Drupal\Core\Url;
/**
* Provides a toolbar item that is wrapped in markup for common styling.
@@ -33,7 +34,7 @@ public function getInfo() {
'tab' => array(
'#type' => 'link',
'#title' => NULL,
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
),
);
}
diff --git a/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module
index deda1d1..9d4e89f 100644
--- a/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module
+++ b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module
@@ -17,7 +17,7 @@ function toolbar_test_toolbar() {
'tab' => array(
'#type' => 'link',
'#title' => t('Test tab'),
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
'#options' => array(
'html' => FALSE,
'attributes' => array(
diff --git a/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php b/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
index df08109..72dae7c 100644
--- a/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
+++ b/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
@@ -121,7 +121,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'link' => array(
'#type' => 'link',
'#title' => '' . $this->t('Remove') . '',
- '#route_name' => '',
+ '#url' => Url::fromRoute(''),
'#options' => array(
'html' => TRUE,
),