diff --git a/core/modules/content_translation/src/Controller/ContentTranslationController.php b/core/modules/content_translation/src/Controller/ContentTranslationController.php index 93b4887..6c62515 100644 --- a/core/modules/content_translation/src/Controller/ContentTranslationController.php +++ b/core/modules/content_translation/src/Controller/ContentTranslationController.php @@ -122,11 +122,13 @@ public function overview(Request $request, $entity_type_id = NULL) { $source = isset($entity->translation[$langcode]['source']) ? $entity->translation[$langcode]['source'] : ''; $is_original = $langcode == $original; $label = $entity->getTranslation($langcode)->label(); - $link = isset($links->links[$langcode]['href']) ? $links->links[$langcode] : array('href' => $entity->getSystemPath()); - $link += array('language' => $language); - $row_title = l($label, $link['href'], $link); + $link = isset($links->links[$langcode]['url']) ? $links->links[$langcode] : array('url' => $entity->urlInfo()); + if (!empty($link['url'])) { + $link['url']->setOption('language', $language); + $row_title = \Drupal::linkGenerator()->generateFromUrl($label, $link['url']); + } - if (empty($link['href'])) { + if (empty($link['url'])) { $row_title = $is_original ? $label : $this->t('n/a'); } @@ -135,7 +137,7 @@ public function overview(Request $request, $entity_type_id = NULL) { // language we point the link to the translation form. if ($entity->access('update')) { $links['edit'] = array( - 'href' => $entity->getSystemPath('edit-form'), + 'url' => $entity->urlInfo('edit-form'), 'language' => $language, ); } diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php index e78a194..aa03882 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php +++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php @@ -51,7 +51,7 @@ public function defaultValuesForm(array &$form, FormStateInterface $form_state) 'default_date' => array( '#type' => 'textfield', '#title' => t('Relative default value'), - '#description' => t("Describe a time by reference to the current day, like '+90 days' (90 days from the day the field is created) or '+1 Saturday' (the next Saturday). See !strtotime for more details.", array('!strtotime' => l('strtotime', 'http://www.php.net/manual/en/function.strtotime.php'))), + '#description' => t("Describe a time by reference to the current day, like '+90 days' (90 days from the day the field is created) or '+1 Saturday' (the next Saturday). See @strtotime for more details.", array('@strtotime' => 'strtotime', '@url' => 'http://www.php.net/manual/en/function.strtotime.php')), '#default_value' => (isset($default_value[0]['default_date_type']) && $default_value[0]['default_date_type'] == static::DEFAULT_VALUE_CUSTOM) ? $default_value[0]['default_date'] : '', '#states' => array( 'visible' => array( diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc index fad16b0..e6b955e 100644 --- a/core/modules/node/node.admin.inc +++ b/core/modules/node/node.admin.inc @@ -128,7 +128,7 @@ function _node_mass_update_batch_process(array $nodes, array $updates, $load, $r $node = _node_mass_update_helper($node, $updates); // Store result for post-processing in the finished callback. - $context['results'][] = \Drupal::l($node->label(), 'entity.node.canonical', array('node' => $node->id())); + $context['results'][] = \Drupal::linkGenerator()->generateFromUrl($node->label(), $node->urlInfo()); // Update our progress information. $context['sandbox']['progress']++; diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 6ec3465..c085aea 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -202,7 +202,8 @@ function node_title_list($result, $title = NULL) { $num_rows = FALSE; foreach ($result as $node) { // Do not use $node->label() here, because $node comes from the database. - $items[] = \Drupal::l($node->title, 'entity.node.canonical', array('node' => $node->nid), !empty($node->comment_count) ? array('attributes' => array('title' => format_plural($node->comment_count, '1 comment', '@count comments'))) : array()); + $url = $node->urlInfo('canonical', !empty($node->comment_count) ? array('attributes' => array('title' => format_plural($node->comment_count, '1 comment', '@count comments'))) : array()); + $items[] = \Drupal::linkGenerator()->generateFromUrl($node->title, $url); $num_rows = TRUE; } diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php index 70c2cfe..5b5cdd9 100644 --- a/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -408,7 +408,7 @@ public function save(array $form, FormStateInterface $form_state) { $node = $this->entity; $insert = $node->isNew(); $node->save(); - $node_link = \Drupal::l(t('View'), 'entity.node.canonical', array('node' => $node->id())); + $node_link = \Drupal::linkGenerator()->generateFromUrl(t('View'), $node->urlInfo()); $context = array('@type' => $node->getType(), '%title' => $node->label(), 'link' => $node_link); $t_args = array('@type' => node_get_type_label($node), '%title' => $node->label()); diff --git a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php index ceb71f7..ea5fcca 100644 --- a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php +++ b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php @@ -48,7 +48,7 @@ protected function setUp() { // Link the node to itself to test that it's only indexed once. The content // also needs the word "pizza" so we can use it as the search keyword. $body_key = 'body[0][value]'; - $edit[$body_key] = \Drupal::l($node->label(), 'entity.node.canonical', array('node' => $node->id())) . ' pizza sandwich'; + $edit[$body_key] = \Drupal::linkGenerator()->generateFromUrl($node->label(), $node->urlInfo()) . ' pizza sandwich'; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); $this->container->get('plugin.manager.search')->createInstance('node_search')->updateIndex(); diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php index eb9d9a0..d17d6c2 100644 --- a/core/modules/search/src/Tests/SearchRankingTest.php +++ b/core/modules/search/src/Tests/SearchRankingTest.php @@ -218,7 +218,7 @@ public function testHTMLRankings() { foreach ($shuffled_tags as $tag) { switch ($tag) { case 'a': - $settings['body'] = array(array('value' => l('Drupal Rocks', 'node'), 'format' => 'full_html')); + $settings['body'] = array(array('value' => \Drupal::l('Drupal Rocks', 'view.frontpage.page_1'), 'format' => 'full_html')); break; case 'notag': $settings['body'] = array(array('value' => 'Drupal Rocks')); diff --git a/core/modules/shortcut/src/Form/SetCustomize.php b/core/modules/shortcut/src/Form/SetCustomize.php index f1a23b6..143489d 100644 --- a/core/modules/shortcut/src/Form/SetCustomize.php +++ b/core/modules/shortcut/src/Form/SetCustomize.php @@ -52,7 +52,7 @@ public function form(array $form, FormStateInterface $form_state) { foreach ($this->entity->getShortcuts() as $shortcut) { $id = $shortcut->id(); $form['shortcuts']['links'][$id]['#attributes']['class'][] = 'draggable'; - $form['shortcuts']['links'][$id]['name']['#markup'] = \Drupal::l($shortcut->getTitle(), $shortcut->getRouteName(), $shortcut->getRouteParams()); + $form['shortcuts']['links'][$id]['name']['#markup'] = \Drupal::l($shortcut->getTitle(), $shortcut->getUrl()); $form['shortcuts']['links'][$id]['#weight'] = $shortcut->getWeight(); $form['shortcuts']['links'][$id]['weight'] = array( '#type' => 'weight', diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 54deb65..581e18f 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1173,10 +1173,10 @@ function system_time_zones($blank = NULL) { function theme_system_compact_link() { $output = ''; diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index 3466e55..c6f0c1e 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -13,6 +13,7 @@ use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\Xss; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Url; use Drupal\views\Plugin\views\HandlerBase; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\ResultRow;