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/locale/locale.install b/core/modules/locale/locale.install index 197eded..0fa0b24 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -260,7 +260,7 @@ function locale_requirements($phase) { if ($available_updates) { $requirements['locale_translation'] = array( 'title' => 'Translation update status', - 'value' => l(t('Updates available'), 'admin/reports/translations'), + 'value' => \Drupal::l(t('Updates available'), 'locale.translate_status'), 'severity' => REQUIREMENT_WARNING, 'description' => t('Updates available for: @languages. See the Available translation updates page for more information.', array('@languages' => implode(', ', $available_updates), '@updates' => url('admin/reports/translations'))), ); @@ -285,7 +285,7 @@ function locale_requirements($phase) { else { $requirements['locale_translation'] = array( 'title' => 'Translation update status', - 'value' => l(t('Can not determine status'), 'admin/reports/translations'), + 'value' => \Drupal::l(t('Can not determine status'), 'locale.translate_status'), 'severity' => REQUIREMENT_WARNING, 'description' => t('No translation status is available. See the Available translation updates page for more information.', array('@updates' => url('admin/reports/translations'))), ); diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index fe938a3..0b480cb 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -594,13 +594,13 @@ function locale_form_language_admin_overview_form_alter(&$form, FormStateInterfa ); if (!$language->locked && ($langcode != 'en' || locale_translate_english())) { $form['languages'][$langcode]['locale_statistics'] = array( - '#markup' => l( + '#markup' => \Drupal::l( t('@translated/@total (@ratio%)', array( '@translated' => $stats[$langcode]['translated'], '@total' => $total_strings, '@ratio' => $stats[$langcode]['ratio'], )), - 'admin/config/regional/translate', + 'locale.translate_page', array('query' => array('langcode' => $langcode)) ), ); diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index dc6043b..6580273 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -157,5 +157,5 @@ function template_preprocess_locale_translation_last_check(&$variables) { $last = $variables['last']; $variables['last_checked'] = ($last != NULL); $variables['time'] = \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $last); - $variables['link'] = l(t('Check manually'), 'admin/reports/translations/check', array('query' => drupal_get_destination())); + $variables['link'] = \Drupal::l(t('Check manually'), 'locale.check_translation', [], ['query' => drupal_get_destination()]); } diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc index b0a806d..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'][] = l($node->label(), '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.install b/core/modules/node/node.install index be6d938..fbe4313 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -32,7 +32,7 @@ function node_requirements($phase) { 'value' => $value, // The result of t() is safe and so is the result of l(). Preserving // safe object. - 'description' => SafeMarkup::set($description . ' ' . l(t('Rebuild permissions'), 'admin/reports/status/rebuild')), + 'description' => SafeMarkup::set($description . ' ' . \Drupal::l(t('Rebuild permissions'), 'node.configure_rebuild_confirm')), ); } return $requirements; diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 091d601..bb3357e 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -202,7 +202,10 @@ 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[] = l($node->title, 'node/' . $node->nid, !empty($node->comment_count) ? array('attributes' => array('title' => format_plural($node->comment_count, '1 comment', '@count comments'))) : array()); + $options = !empty($node->comment_count) ? array('attributes' => array('title' => format_plural($node->comment_count, '1 comment', '@count comments'))) : array(); + $url = $node->urlInfo(); + $url->setOptions($options); + $items[] = \Drupal::linkGenerator()->generateFromUrl($node->title, $url); $num_rows = TRUE; } diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index 517a5d5..b758d2f 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -31,7 +31,7 @@ function template_preprocess_node_add_list(&$variables) { foreach ($variables['content'] as $type) { $variables['types'][$type->type] = array( 'type' => $type->type, - 'add_link' => l($type->name, 'node/add/' . $type->type), + 'add_link' => \Drupal::l($type->name, 'node.add', ['node_type' => $type->type]), 'description' => Xss::filterAdmin($type->description), ); } diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php index 45343d5..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 = l(t('View'), '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/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php index e60ee82..e99d860 100644 --- a/core/modules/node/src/NodeTypeForm.php +++ b/core/modules/node/src/NodeTypeForm.php @@ -230,7 +230,7 @@ public function save(array $form, FormStateInterface $form_state) { } elseif ($status == SAVED_NEW) { drupal_set_message(t('The content type %name has been added.', $t_args)); - $context = array_merge($t_args, array('link' => l(t('View'), 'admin/structure/types'))); + $context = array_merge($t_args, array('link' => \Drupal::l(t('View'), 'node.overview_types'))); $this->logger('node')->notice('Added content type %name.', $context); } diff --git a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php index fe129f8..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] = l($node->label(), '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 536828d..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'] = l($shortcut->getTitle(), $shortcut->path->value); + $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.install b/core/modules/system/system.install index b9c1b83..c8150ed 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -59,7 +59,7 @@ function system_requirements($phase) { $requirements['php'] = array( 'title' => t('PHP'), // $phpversion is safe and output of l() is safe, so this value is safe. - 'value' => SafeMarkup::set(($phase == 'runtime') ? $phpversion . ' (' . l(t('more information'), 'admin/reports/status/php') . ')' : $phpversion), + 'value' => SafeMarkup::set(($phase == 'runtime') ? $phpversion . ' (' . \Drupal::l(t('more information'), 'system.php') . ')' : $phpversion), ); } else { 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;