diff --git a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php b/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php index 745f256..5fc2e2b 100644 --- a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php +++ b/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php @@ -107,7 +107,7 @@ public function testFeedPage() { // Find the expected read_more link on the sources page. $href = $feed->url(); - $links = $this->xpath('//a[@href = :href]', array(':href' => url($href))); + $links = $this->xpath('//a[@href = :href]', array(':href' => $href)); $this->assertTrue(isset($links[0]), String::format('Link to href %href found.', array('%href' => $href))); $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags'); $cache_tags = explode(' ', $cache_tags_header); diff --git a/core/modules/aggregator/src/Tests/DeleteFeedItemTest.php b/core/modules/aggregator/src/Tests/DeleteFeedItemTest.php index d031f53..b3965af 100644 --- a/core/modules/aggregator/src/Tests/DeleteFeedItemTest.php +++ b/core/modules/aggregator/src/Tests/DeleteFeedItemTest.php @@ -20,13 +20,13 @@ function testDeleteFeedItem() { // Create a bunch of test feeds. $feed_urls = array(); // No last-modified, no etag. - $feed_urls[] = url('aggregator/test-feed', array('absolute' => TRUE)); + $feed_urls[] = \Drupal::url('aggregator_test.feed', array(), array('absolute' => TRUE)); // Last-modified, but no etag. - $feed_urls[] = url('aggregator/test-feed/1', array('absolute' => TRUE)); + $feed_urls[] = \Drupal::url('aggregator_test.feed', array('use_last_modified' => 1), array('absolute' => TRUE)); // No Last-modified, but etag. - $feed_urls[] = url('aggregator/test-feed/0/1', array('absolute' => TRUE)); + $feed_urls[] = \Drupal::url('aggregator_test.feed', array('use_last_modified' => 0, 'use_etag' => 1), array('absolute' => TRUE)); // Last-modified and etag. - $feed_urls[] = url('aggregator/test-feed/1/1', array('absolute' => TRUE)); + $feed_urls[] = \Drupal::url('aggregator_test.feed', array('use_last_modified' => 1, 'use_etag' => 1), array('absolute' => TRUE)); foreach ($feed_urls as $feed_url) { $feed = $this->createFeed($feed_url); diff --git a/core/modules/aggregator/src/Tests/FeedParserTest.php b/core/modules/aggregator/src/Tests/FeedParserTest.php index 7489e9f..2ac0a94 100644 --- a/core/modules/aggregator/src/Tests/FeedParserTest.php +++ b/core/modules/aggregator/src/Tests/FeedParserTest.php @@ -86,7 +86,7 @@ function testRedirectFeed() { $feed->refreshItems(); // Make sure that the feed URL was updated correctly. - $this->assertEqual($feed->getUrl(), url('aggregator/test-feed', array('absolute' => TRUE))); + $this->assertEqual($feed->getUrl(), \Drupal::url('aggregator_test.feed', array(), array('absolute' => TRUE))); } /** diff --git a/core/modules/block/src/Tests/BlockTest.php b/core/modules/block/src/Tests/BlockTest.php index 234077c..9a77486 100644 --- a/core/modules/block/src/Tests/BlockTest.php +++ b/core/modules/block/src/Tests/BlockTest.php @@ -289,7 +289,7 @@ public function testBlockCacheTags() { // both the page and block caches. $this->drupalGet(''); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); - $cid_parts = array(url('', array('absolute' => TRUE)), 'html'); + $cid_parts = array(\Drupal::url('', array(), array('absolute' => TRUE)), 'html'); $cid = sha1(implode(':', $cid_parts)); $cache_entry = \Drupal::cache('render')->get($cid); $expected_cache_tags = array( @@ -329,7 +329,7 @@ public function testBlockCacheTags() { // Verify a cache hit, but also the presence of the correct cache tags. $this->drupalGet(''); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); - $cid_parts = array(url('', array('absolute' => TRUE)), 'html'); + $cid_parts = array(\Drupal::url('', array(), array('absolute' => TRUE)), 'html'); $cid = sha1(implode(':', $cid_parts)); $cache_entry = \Drupal::cache('render')->get($cid); $expected_cache_tags = array( diff --git a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php index 9e40c81..793e8be 100644 --- a/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php +++ b/core/modules/block_content/src/Plugin/Block/BlockContentBlock.php @@ -156,7 +156,7 @@ public function build() { return array( '#markup' => t('Block with uuid %uuid does not exist. Add custom block.', array( '%uuid' => $uuid, - '!url' => url('block/add') + '!url' => \Drupal::url('block_content.add_page'), )), '#access' => $this->account->hasPermission('administer blocks') ); diff --git a/core/modules/block_content/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php index 8a20eec..cf2bea0 100644 --- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php +++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php @@ -87,7 +87,7 @@ public function testBlockContentTypeEditing() { $this->drupalGet('block/add'); $this->assertRaw('Bar', 'New name was displayed.'); $this->clickLink('Bar'); - $this->assertEqual(url('block/add/basic', array('absolute' => TRUE)), $this->getUrl(), 'Original machine name was used in URL.'); + $this->assertEqual(\Drupal::url('block_content.add_form', array('block_content_type' => 'basic'), array('absolute' => TRUE)), $this->getUrl(), 'Original machine name was used in URL.'); // Remove the body field. $this->drupalPostForm('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete', array(), t('Delete')); @@ -162,7 +162,7 @@ public function testsBlockContentAddTypes() { // The seven theme has markup inside the link, we cannot use clickLink(). if ($default_theme == 'seven') { $options = $theme != $default_theme ? array('query' => array('theme' => $theme)) : array(); - $this->assertLinkByHref(url('block/add/foo', $options)); + $this->assertLinkByHref(\Drupal::url('block_content.add_form', array('block_content_type' => 'foo'), $options)); $this->drupalGet('block/add/foo', $options); } else { @@ -174,10 +174,9 @@ public function testsBlockContentAddTypes() { $blocks = $storage->loadByProperties(array('info' => $edit['info[0][value]'])); if (!empty($blocks)) { $block = reset($blocks); - $destination = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $theme; - $this->assertUrl(url($destination, array('absolute' => TRUE))); + $this->assertUrl(\Drupal::url('block.admin_add', array('plugin_id' => 'block_content' . $block->uuid(), 'theme' => $theme), array('absolute' => TRUE))); $this->drupalPostForm(NULL, array(), t('Save block')); - $this->assertUrl(url("admin/structure/block/list/$theme", array('absolute' => TRUE, 'query' => array('block-placement' => drupal_html_class($edit['info[0][value]']))))); + $this->assertUrl(\Drupal::url('block.admin_display_theme', array('theme' => $theme), array('absolute' => TRUE, 'query' => array('block-placement' => drupal_html_class($edit['info[0][value]']))))); } else { $this->fail('Could not load created block.'); @@ -194,8 +193,7 @@ public function testsBlockContentAddTypes() { $this->drupalPostForm(NULL, $edit, t('Save')); $blocks = $storage->loadByProperties(array('info' => $edit['info[0][value]'])); if (!empty($blocks)) { - $destination = 'admin/structure/block/block-content'; - $this->assertUrl(url($destination, array('absolute' => TRUE))); + $this->assertUrl(\Drupal::url('block_content.list', array(), array('absolute' => TRUE))); } else { $this->fail('Could not load created block.'); diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php index 2e6e851..fff81f5 100644 --- a/core/modules/book/src/Tests/BookTest.php +++ b/core/modules/book/src/Tests/BookTest.php @@ -200,9 +200,9 @@ function checkBookNode(EntityInterface $node, $nodes, $previous = FALSE, $up = F // Compute the expected breadcrumb. $expected_breadcrumb = array(); - $expected_breadcrumb[] = url(''); + $expected_breadcrumb[] = \Drupal::url(''); foreach ($breadcrumb as $a_node) { - $expected_breadcrumb[] = url('node/' . $a_node->id()); + $expected_breadcrumb[] = $a_node->url(); } // Fetch links in the current breadcrumb. diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc index b34fdcb..227c724 100644 --- a/core/modules/comment/comment.tokens.inc +++ b/core/modules/comment/comment.tokens.inc @@ -165,12 +165,12 @@ function comment_tokens($type, $tokens, array $data = array(), array $options = // Comment related URLs. case 'url': $url_options['fragment'] = 'comment-' . $comment->id(); - $replacements[$original] = url('comment/' . $comment->id(), $url_options); + $replacements[$original] = $comment->url('canonical', $url_options); break; case 'edit-url': $url_options['fragment'] = NULL; - $replacements[$original] = url('comment/' . $comment->id() . '/edit', $url_options); + $replacements[$original] = $comment->url('edit-form', $url_options); break; // @todo Remove 'name' token in favour of 'author'. See diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php index 2c99bf8..e7fe595 100644 --- a/core/modules/comment/src/CommentForm.php +++ b/core/modules/comment/src/CommentForm.php @@ -95,7 +95,7 @@ public function form(array $form, FormStateInterface $form_state) { // If not replying to a comment, use our dedicated page callback for new // Comments on entities. if (!$comment->id() && !$comment->hasParentComment()) { - $form['#action'] = url('comment/reply/' . $entity->getEntityTypeId() . '/' . $entity->id() . '/' . $field_name); + $form['#action'] = \Drupal::url('comment.reply', array('entity_type' => $entity->getEntityTypeId(), 'entity' => $entity->id(), 'field_name' => $field_name)); } $comment_preview = $form_state->get('comment_preview'); diff --git a/core/modules/comment/src/Tests/CommentInterfaceTest.php b/core/modules/comment/src/Tests/CommentInterfaceTest.php index 94e423c..083d669 100644 --- a/core/modules/comment/src/Tests/CommentInterfaceTest.php +++ b/core/modules/comment/src/Tests/CommentInterfaceTest.php @@ -99,7 +99,7 @@ function testCommentInterface() { // \Drupal\comment\Controller\CommentController::redirectNode(). $this->drupalGet('comment/' . $this->node->id() . '/reply'); // Verify we were correctly redirected. - $this->assertUrl(url('comment/reply/node/' . $this->node->id() . '/comment', array('absolute' => TRUE))); + $this->assertUrl(\Drupal::url('comment.reply', array('entity_type' => 'node', 'entity' => $this->node->id(), 'field' => 'comment'), array('absolute' => TRUE))); $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id()); $this->assertText($subject_text, 'Individual comment-reply subject found.'); $this->assertText($comment_text, 'Individual comment-reply body found.'); diff --git a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php index 59c21ff..d057415 100644 --- a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php +++ b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php @@ -55,7 +55,7 @@ protected function renderNewCommentsNodeLinks(array $node_ids) { // Perform HTTP request. return $this->curlExec(array( - CURLOPT_URL => url('comments/render_new_comments_node_links', array('absolute' => TRUE)), + CURLOPT_URL => \Drupal::url('comment.new_comments_node_links', array(), array('absolute' => TRUE)), CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => array( @@ -114,7 +114,7 @@ public function testCommentNewCommentsIndicator() { $json = Json::decode($response); $expected = array($this->node->id() => array( 'new_comment_count' => 1, - 'first_new_comment_link' => url('node/' . $this->node->id(), array('fragment' => 'new')), + 'first_new_comment_link' => $this->node->url('canonical', array('fragment' => 'new')), )); $this->assertIdentical($expected, $json); diff --git a/core/modules/comment/src/Tests/CommentRssTest.php b/core/modules/comment/src/Tests/CommentRssTest.php index cfa62f9..9d6e4fd 100644 --- a/core/modules/comment/src/Tests/CommentRssTest.php +++ b/core/modules/comment/src/Tests/CommentRssTest.php @@ -31,7 +31,7 @@ function testCommentRss() { $this->drupalLogin($this->web_user); $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName()); $this->drupalGet('rss.xml'); - $raw = '' . url('node/' . $this->node->id(), array('fragment' => 'comments', 'absolute' => TRUE)) . ''; + $raw = '' . $this->node->url('canonical', array('fragment' => 'comments', 'absolute' => TRUE)) . ''; $this->assertRaw($raw, 'Comments as part of RSS feed.'); // Hide comments from RSS feed and check presence. diff --git a/core/modules/comment/src/Tests/CommentTokenReplaceTest.php b/core/modules/comment/src/Tests/CommentTokenReplaceTest.php index 97335f8..76eca29 100644 --- a/core/modules/comment/src/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/src/Tests/CommentTokenReplaceTest.php @@ -57,8 +57,8 @@ function testCommentTokenReplacement() { $tests['[comment:homepage]'] = check_url($comment->getHomepage()); $tests['[comment:title]'] = Xss::filter($comment->getSubject()); $tests['[comment:body]'] = $comment->comment_body->processed; - $tests['[comment:url]'] = url('comment/' . $comment->id(), $url_options + array('fragment' => 'comment-' . $comment->id())); - $tests['[comment:edit-url]'] = url('comment/' . $comment->id() . '/edit', $url_options); + $tests['[comment:url]'] = $comment->url('canonical', $url_options + array('fragment' => 'comment-' . $comment->id())); + $tests['[comment:edit-url]'] = $comment->url('edit-form', $url_options); $tests['[comment:created:since]'] = \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $comment->getCreatedTime(), 2, $language_interface->id); $tests['[comment:changed:since]'] = \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $comment->getChangedTime(), 2, $language_interface->id); $tests['[comment:parent:cid]'] = $comment->hasParentComment() ? $comment->getParentComment()->id() : NULL; diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php index 75883f6..55b8b16 100644 --- a/core/modules/comment/src/Tests/CommentTypeTest.php +++ b/core/modules/comment/src/Tests/CommentTypeTest.php @@ -108,7 +108,7 @@ public function testCommentTypeEditing() { $this->drupalGet('admin/structure/comment'); $this->assertRaw('Bar', 'New name was displayed.'); $this->clickLink('Manage fields'); - $this->assertEqual(url('admin/structure/comment/manage/comment/fields', array('absolute' => TRUE)), $this->getUrl(), 'Original machine name was used in URL.'); + $this->assertEqual(\Drupal::url('field_ui.overview_comment_id', array(), array('absolute' => TRUE)), $this->getUrl(), 'Original machine name was used in URL.'); // Remove the body field. $this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete', array(), t('Delete')); diff --git a/core/modules/config/tests/config_test/src/ConfigTestController.php b/core/modules/config/tests/config_test/src/ConfigTestController.php index fa7618c..5e8e8fd 100644 --- a/core/modules/config/tests/config_test/src/ConfigTestController.php +++ b/core/modules/config/tests/config_test/src/ConfigTestController.php @@ -41,7 +41,7 @@ public function editTitle(ConfigTest $config_test) { */ function enable(ConfigTest $config_test) { $config_test->enable()->save(); - return new RedirectResponse(url('admin/structure/config_test', array('absolute' => TRUE))); + return new RedirectResponse(\Drupal::url('config_test.list_page', array(), array('absolute' => TRUE))); } /** @@ -55,7 +55,7 @@ function enable(ConfigTest $config_test) { */ function disable(ConfigTest $config_test) { $config_test->disable()->save(); - return new RedirectResponse(url('admin/structure/config_test', array('absolute' => TRUE))); + return new RedirectResponse(\Drupal::url('config_test.list_page', array(), array('absolute' => TRUE))); } } diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 23743a1..db2ec60 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -22,18 +22,18 @@ function contact_help($route_name, RouteMatchInterface $route_match) { $output .= '
' . t('User contact forms') . '
'; $output .= '
' . t('Site users can be contacted with a user contact form that keeps their email address private. Users may enable or disable their personal contact forms by editing their My account page. If enabled, a Contact tab leads to a personal contact form displayed on their user profile. Site administrators are still able to use the contact form, even if has been disabled. The Contact tab is not shown when you view your own profile.') . '
'; $output .= '
' . t('Site-wide contact forms') . '
'; - $output .= '
' . t('The Contact page provides a simple form for users with the Use the site-wide contact form permission to send comments, feedback, or other requests. You can create forms for directing the contact messages to a set of defined recipients. Common forms for a business site, for example, might include "Website feedback" (messages are forwarded to website administrators) and "Product information" (messages are forwarded to members of the sales department). Email addresses defined within a form are not displayed publicly.', array('@contact' => url('contact'))) . '

'; + $output .= '
' . t('The Contact page provides a simple form for users with the Use the site-wide contact form permission to send comments, feedback, or other requests. You can create forms for directing the contact messages to a set of defined recipients. Common forms for a business site, for example, might include "Website feedback" (messages are forwarded to website administrators) and "Product information" (messages are forwarded to members of the sales department). Email addresses defined within a form are not displayed publicly.', array('@contact' => \Drupal::url('contact.site_page'))) . '

'; $output .= '
' . t('Navigation') . '
'; - $output .= '
' . t('When the site-wide contact form is enabled, a link in the Footer menu is created, which you can modify on the Menus administration page.', array('@menu' => url('admin/structure/menu'))) . '
'; + $output .= '
' . t('When the site-wide contact form is enabled, a link in the Footer menu is created, which you can modify on the Menus administration page.', array('@menu' => \Drupal::url('menu_ui.overview_page'))) . '
'; $output .= '
' . t('Customization') . '
'; - $output .= '
' . t('If you would like additional text to appear on the site-wide or personal contact page, use a block. You can create and edit blocks on the Blocks administration page.', array('@blocks' => url('admin/structure/block'))) . '
'; + $output .= '
' . t('If you would like additional text to appear on the site-wide or personal contact page, use a block. You can create and edit blocks on the Blocks administration page.', array('@blocks' => \Drupal::url('block.admin_display'))) . '
'; $output .= ''; return $output; case 'contact.form_list': - $output = '

' . t('Add one or more forms on this page to set up your site-wide contact form.', array('@form' => url('contact'))) . '

'; - $output .= '

' . t('A Contact menu item is added to the Footer menu, which you can modify on the Menus administration page.', array('@menu-settings' => url('admin/structure/menu'))) . '

'; - $output .= '

' . t('If you would like additional text to appear on the site-wide contact page, use a block. You can create and edit blocks on the Blocks administration page.', array('@blocks' => url('admin/structure/block'))) . '

'; + $output = '

' . t('Add one or more forms on this page to set up your site-wide contact form.', array('@form' => \Drupal::url('contact.site_page'))) . '

'; + $output .= '

' . t('A Contact menu item is added to the Footer menu, which you can modify on the Menus administration page.', array('@menu-settings' => \Drupal::url('menu_ui.overview_page'))) . '

'; + $output .= '

' . t('If you would like additional text to appear on the site-wide contact page, use a block. You can create and edit blocks on the Blocks administration page.', array('@blocks' => \Drupal::url('block.admin_display'))) . '

'; return $output; } } diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php index 436b2bf..e91aaff 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@ -59,7 +59,7 @@ function testSiteWideContact() { // field_ui enabled admin/structure/contact/manage/personal/fields exists. // @todo: See https://drupal.org/node/2031223 for the above $edit_link = $this->xpath('//a[@href=:href]', array( - ':href' => url('admin/structure/contact/manage/personal') + ':href' => \Drupal::url('field_ui.field_edit_comment', array('field_config' => 'personal')) )); $this->assertTrue(empty($edit_link), format_string('No link containing href %href found.', array('%href' => 'admin/structure/contact/manage/personal') diff --git a/core/modules/content_translation/content_translation.install b/core/modules/content_translation/content_translation.install index 4aa7e73..34d2717 100644 --- a/core/modules/content_translation/content_translation.install +++ b/core/modules/content_translation/content_translation.install @@ -96,12 +96,12 @@ function content_translation_install() { function content_translation_enable() { // Translation works when at least two languages are added. if (count(\Drupal::languageManager()->getLanguages()) < 2) { - $t_args = array('!language_url' => url('admin/config/regional/language')); + $t_args = array('!language_url' => \Drupal::url('language.admin_overview')); $message = t('Be sure to add at least two languages to translate content.', $t_args); drupal_set_message($message, 'warning'); } // Point the user to the content translation settings. - $t_args = array('!settings_url' => url('admin/config/regional/content-language')); + $t_args = array('!settings_url' => \Drupal::url('language.content_settings_page')); $message = t('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.', $t_args); drupal_set_message($message, 'warning'); } diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 1119ab8..a2e204e 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -566,7 +566,7 @@ function content_translation_form_field_ui_field_edit_form_alter(array &$form, F // Provide helpful pointers for administrators. if (\Drupal::currentUser()->hasPermission('administer content translation') && !$bundle_is_translatable) { - $toggle_url = url('admin/config/regional/content-language', array( + $toggle_url = \Drupal::url('language.content_settings_page', array(), array( 'query' => drupal_get_destination(), )); $form['field']['translatable']['#description'] = t('To configure translation for this field, enable language support for this type.', array( diff --git a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php index 0b8e128..81c0ce0 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php @@ -170,7 +170,7 @@ protected function renderContextualLinks($ids, $current_path) { // Perform HTTP request. return $this->curlExec(array( - CURLOPT_URL => url('contextual/render', array('absolute' => TRUE, 'query' => array('destination' => $current_path))), + CURLOPT_URL => \Drupal::url('contextual.render', array(), array('absolute' => TRUE, 'query' => array('destination' => $current_path))), CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => array( diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module index 3531ed9..af28eba 100644 --- a/core/modules/dblog/dblog.module +++ b/core/modules/dblog/dblog.module @@ -102,7 +102,7 @@ function dblog_form_system_logging_settings_alter(&$form, FormStateInterface $fo '#title' => t('Database log messages to keep'), '#default_value' => \Drupal::config('dblog.settings')->get('row_limit'), '#options' => array(0 => t('All')) + array_combine($row_limits, $row_limits), - '#description' => t('The maximum number of messages to keep in the database log. Requires a cron maintenance task.', array('@cron' => url('admin/reports/status'))) + '#description' => t('The maximum number of messages to keep in the database log. Requires a cron maintenance task.', array('@cron' => \Drupal::url('system.status'))) ); $form['#submit'][] = 'dblog_logging_settings_submit'; diff --git a/core/modules/field/field.module b/core/modules/field/field.module index dc814a0..5809bae 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -139,7 +139,7 @@ function field_system_info_alter(&$info, Extension $file, $type) { } if ($non_deleted) { if (\Drupal::moduleHandler()->moduleExists('field_ui')) { - $explanation = t('Field type(s) in use - see Field list', array('@fields-page' => url('admin/reports/fields'))); + $explanation = t('Field type(s) in use - see Field list', array('@fields-page' => \Drupal::url('field_ui.list'))); } else { $explanation = t('Fields type(s) in use'); diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index f0c8487..5bce9dd 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -21,7 +21,7 @@ function field_ui_help($route_name, RouteMatchInterface $route_match) { case 'help.page.field_ui': $output = ''; $output .= '

' . t('About') . '

'; - $output .= '

' . t('The Field UI module provides an administrative user interface (UI) for attaching and managing fields. Fields can be defined at the content-type level for content items and comments, at the vocabulary level for taxonomy terms, and at the site level for user accounts. Other modules may also enable fields to be defined for their data. Field types (text, image, number, etc.) are defined by modules, and collected and managed by the Field module. For more information, see the online handbook entry for Field UI module.', array('@field' => url('admin/help/field'), '@field_ui' => 'http://drupal.org/documentation/modules/field-ui')) . '

'; + $output .= '

' . t('The Field UI module provides an administrative user interface (UI) for attaching and managing fields. Fields can be defined at the content-type level for content items and comments, at the vocabulary level for taxonomy terms, and at the site level for user accounts. Other modules may also enable fields to be defined for their data. Field types (text, image, number, etc.) are defined by modules, and collected and managed by the Field module. For more information, see the online handbook entry for Field UI module.', array('@field' => \Drupal::url('help.page', array('name' => 'field')), '@field_ui' => 'http://drupal.org/documentation/modules/field-ui')) . '

'; $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Planning fields') . '
'; @@ -40,13 +40,13 @@ function field_ui_help($route_name, RouteMatchInterface $route_match) { $output .= '
' . t('Some settings of a reused field are unique to each use of the field; others are shared across all places you use the field. For example, the label of a text field is unique to each use, while the setting for the number of values is shared.') . '
'; $output .= '
' . t('There are two main reasons for reusing fields. First, reusing fields can save you time over defining new fields. Second, reusing fields also allows you to display, filter, group, and sort content together by field across content types. For example, the contributed Views module allows you to create lists and tables of content. So if you use the same field on multiple content types, you can create a View containing all of those content types together displaying that field, sorted by that field, and/or filtered by that field.') . '
'; $output .= '
' . t('Fields on content items') . '
'; - $output .= '
' . t('Fields on content items are defined at the content-type level, on the Manage fields tab of the content type edit page (which you can reach from the Content types page). When you define a field for a content type, each content item of that type will have that field added to it. Some fields, such as the Title and Body, are provided for you when you create a content type, or are provided on content types created by your installation profile.', array('@types' => url('admin/structure/types'))) . '
'; + $output .= '
' . t('Fields on content items are defined at the content-type level, on the Manage fields tab of the content type edit page (which you can reach from the Content types page). When you define a field for a content type, each content item of that type will have that field added to it. Some fields, such as the Title and Body, are provided for you when you create a content type, or are provided on content types created by your installation profile.', array('@types' => \Drupal::url('node.overview_types'))) . '
'; $output .= '
' . t('Fields on taxonomy terms') . '
'; - $output .= '
' . t('Fields on taxonomy terms are defined at the taxonomy vocabulary level, on the Manage fields tab of the vocabulary edit page (which you can reach from the Taxonomy page). When you define a field for a vocabulary, each term in that vocabulary will have that field added to it. For example, you could define an image field for a vocabulary to store an icon with each term.', array('@taxonomy' => url('admin/structure/taxonomy'))) . '
'; + $output .= '
' . t('Fields on taxonomy terms are defined at the taxonomy vocabulary level, on the Manage fields tab of the vocabulary edit page (which you can reach from the Taxonomy page). When you define a field for a vocabulary, each term in that vocabulary will have that field added to it. For example, you could define an image field for a vocabulary to store an icon with each term.', array('@taxonomy' => \Drupal::url('taxonomy.vocabulary_list'))) . '
'; $output .= '
' . t('Fields on user accounts') . '
'; - $output .= '
' . t('Fields on user accounts are defined on a site-wide basis on the Manage fields tab of the Account settings page. When you define a field for user accounts, each user account will have that field added to it. For example, you could add a long text field to allow users to include a biography.', array('@fields' => url('admin/config/people/accounts/fields'), '@accounts' => url('admin/config/people/accounts'))) . '
'; + $output .= '
' . t('Fields on user accounts are defined on a site-wide basis on the Manage fields tab of the Account settings page. When you define a field for user accounts, each user account will have that field added to it. For example, you could add a long text field to allow users to include a biography.', array('@fields' => \Drupal::url('field_ui.overview_user'), '@accounts' => \Drupal::url('entity.user.admin_form'))) . '
'; $output .= '
' . t('Fields on comments') . '
'; - $output .= '
' . t('Fields on comments are defined at the content-type level, on the Comment fields tab of the content type edit page (which you can reach from the Content types page). When you add a field for comments, each comment on a content item of that type will have that field added to it. For example, you could add a website field to the comments on forum posts, to allow forum commenters to add a link to their website.', array('@types' => url('admin/structure/types'))) . '
'; + $output .= '
' . t('Fields on comments are defined at the content-type level, on the Comment fields tab of the content type edit page (which you can reach from the Content types page). When you add a field for comments, each comment on a content item of that type will have that field added to it. For example, you could add a website field to the comments on forum posts, to allow forum commenters to add a link to their website.', array('@types' => \Drupal::url('node.overview_types'))) . '
'; $output .= '
'; $output .= '
' . t('Managing view modes') . '
'; $output .= '
' . t('Each content entity can have various "modes" for viewing. For instance, a content item could be viewed in full content mode on its own page, teaser mode in a list, or RSS mode in a feed. You can create, edit the names of, and delete view modes on the View modes page. Once a view mode has been set up, you can choose and format fields for the view mode within each entity sub-type on the Manage display page. See the Field UI module help page for more information.', array('!view-modes' => \Drupal::url('field_ui.entity_view_mode_list'), '!field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')))) . '
'; diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index 8cb0a6f..4839309 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -371,7 +371,7 @@ function testNoFieldsDisplayOverview() { )); $this->drupalGet('admin/structure/types/manage/no_fields/display'); - $this->assertRaw(t('There are no fields yet added. You can add new fields on the Manage fields page.', array('@link' => url('admin/structure/types/manage/no_fields/fields')))); + $this->assertRaw(t('There are no fields yet added. You can add new fields on the Manage fields page.', array('@link' => \Drupal::url('field_ui.overview_node', array('node_type' => 'no_fields'))))); } /** diff --git a/core/modules/history/src/Tests/HistoryTest.php b/core/modules/history/src/Tests/HistoryTest.php index 6bce6e1..f0f05b8 100644 --- a/core/modules/history/src/Tests/HistoryTest.php +++ b/core/modules/history/src/Tests/HistoryTest.php @@ -75,7 +75,7 @@ protected function getNodeReadTimestamps(array $node_ids) { // Perform HTTP request. return $this->curlExec(array( - CURLOPT_URL => url('history/get_node_read_timestamps', array('absolute' => TRUE)), + CURLOPT_URL => \Drupal::url('history.get_last_node_view', array(), array('absolute' => TRUE)), CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post, CURLOPT_HTTPHEADER => array( @@ -96,7 +96,7 @@ protected function getNodeReadTimestamps(array $node_ids) { */ protected function markNodeAsRead($node_id) { return $this->curlExec(array( - CURLOPT_URL => url('history/' . $node_id . '/read', array('absolute' => TRUE)), + CURLOPT_URL => \Drupal::url('history.read_node', array('node' => $node_id), array('absolute' => TRUE)), CURLOPT_HTTPHEADER => array( 'Accept: application/json', ), diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 913fb7f..29839d2 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -56,12 +56,12 @@ function image_help($route_name, RouteMatchInterface $route_match) { $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Manipulating images') . '
'; - $output .= '
' . t('With the Image module you can scale, crop, resize, rotate and desaturate images without affecting the original image using image styles. When you change an image style, the module automatically refreshes all created images. Every image style must have a name, which will be used in the URL of the generated images. There are two common approaches to naming image styles (which you use will depend on how the image style is being applied):',array('@image' => url('admin/config/media/image-styles'))); + $output .= '
' . t('With the Image module you can scale, crop, resize, rotate and desaturate images without affecting the original image using image styles. When you change an image style, the module automatically refreshes all created images. Every image style must have a name, which will be used in the URL of the generated images. There are two common approaches to naming image styles (which you use will depend on how the image style is being applied):',array('@image' => \Drupal::url('image.style_list'))); $output .= '
  • ' . t('Based on where it will be used: eg. profile-picture') . '
  • '; $output .= '
  • ' . t('Describing its appearance: eg. square-85x85') . '
'; $output .= t('After you create an image style, you can add effects: crop, scale, resize, rotate, and desaturate (other contributed modules provide additional effects). For example, by combining effects as crop, scale, and desaturate, you can create square, grayscale thumbnails.') . '
'; $output .= '
' . t('Attaching images to content as fields') . '
'; - $output .= '
' . t("Image module also allows you to attach images to content as fields. To add an image field to a content type, go to the content type's manage fields page, and add a new field of type Image. Attaching images to content this way allows image styles to be applied and maintained, and also allows you more flexibility when theming.", array('@content-type' => url('admin/structure/types'))) . '
'; + $output .= '
' . t("Image module also allows you to attach images to content as fields. To add an image field to a content type, go to the content type's manage fields page, and add a new field of type Image. Attaching images to content this way allows image styles to be applied and maintained, and also allows you more flexibility when theming.", array('@content-type' => \Drupal::url('node.overview_types'))) . '
'; $output .= '
'; return $output; diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php index 0253aaf..d173699 100644 --- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php @@ -123,7 +123,7 @@ function _testImageFieldFormatters($scheme) { $elements = $this->xpath( '//a[@href=:path]/img[@src=:url and @alt="" and @width=:width and @height=:height]', array( - ':path' => url('node/' . $nid), + ':path' => $node->url(), ':url' => file_create_url($image['#uri']), ':width' => $image['#width'], ':height' => $image['#height'], diff --git a/core/modules/language/language.module b/core/modules/language/language.module index b0f81de..381fbd4 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -49,7 +49,7 @@ function language_help($route_name, RouteMatchInterface $route_match) { return $output; case 'language.admin_overview': - return '

' . t('Reorder the added languages to set their order in the language switcher block and, when editing content, in the list of selectable languages. This ordering does not impact detection and selection.', array('@detection' => url('admin/config/regional/language/detection'))) . '

'; + return '

' . t('Reorder the added languages to set their order in the language switcher block and, when editing content, in the list of selectable languages. This ordering does not impact detection and selection.', array('@detection' => \Drupal::url('language.negotiation'))) . '

'; case 'language.add': return '

' . t('Add a language to be supported by your site. If your desired language is not available, pick Custom language... at the end and provide a language code and other details manually.') . '

'; @@ -512,7 +512,7 @@ function language_form_system_regional_settings_alter(&$form, FormStateInterface '#title' => t('Default language'), '#default_value' => $default->id, '#options' => $language_options, - '#description' => t('It is not recommended to change the default language on a working site. Configure the Selected language setting on the detection and selection page to change the fallback language for language selection.', array('@language-detection' => url('admin/config/regional/language/detection'))), + '#description' => t('It is not recommended to change the default language on a working site. Configure the Selected language setting on the detection and selection page to change the fallback language for language selection.', array('@language-detection' => \Drupal::url('language.negotiation'))), '#weight' => -1, ); // Add submit handler to save default language. diff --git a/core/modules/language/src/Element/LanguageConfiguration.php b/core/modules/language/src/Element/LanguageConfiguration.php index 5783027..273d733 100644 --- a/core/modules/language/src/Element/LanguageConfiguration.php +++ b/core/modules/language/src/Element/LanguageConfiguration.php @@ -45,7 +45,7 @@ public static function processLanguageConfiguration(&$element, FormStateInterfac '#type' => 'select', '#title' => t('Default language'), '#options' => $options + static::getDefaultOptions(), - '#description' => t('Explanation of the language options is found on the languages list page.', array('@languages_list_page' => url('admin/config/regional/language'))), + '#description' => t('Explanation of the language options is found on the languages list page.', array('@languages_list_page' => \Drupal::url('language.admin_overview'))), '#default_value' => isset($element['#default_value']['langcode']) ? $element['#default_value']['langcode'] : NULL, ); diff --git a/core/modules/language/src/Form/LanguageAddForm.php b/core/modules/language/src/Form/LanguageAddForm.php index e228393..bd3ca0e 100644 --- a/core/modules/language/src/Form/LanguageAddForm.php +++ b/core/modules/language/src/Form/LanguageAddForm.php @@ -94,7 +94,7 @@ public function save(array $form, FormStateInterface $form_state) { // Tell the user they have the option to add a language switcher block // to their theme so they can switch between the languages. - drupal_set_message($this->t('Use one of the language switcher blocks to allow site visitors to switch between languages. You can enable these blocks on the block administration page.', array('@block-admin' => url('admin/structure/block')))); + drupal_set_message($this->t('Use one of the language switcher blocks to allow site visitors to switch between languages. You can enable these blocks on the block administration page.', array('@block-admin' => \Drupal::url('block.admin_display')))); $form_state->setRedirect('language.admin_overview'); } diff --git a/core/modules/language/src/Tests/LanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageConfigurationTest.php index c154429..4d6b64e 100644 --- a/core/modules/language/src/Tests/LanguageConfigurationTest.php +++ b/core/modules/language/src/Tests/LanguageConfigurationTest.php @@ -43,7 +43,7 @@ function testLanguageConfiguration() { ); $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); $this->assertText('French'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), 'Correct page redirection.'); // Langcode for Languages is always 'en'. $language = $this->container->get('config.factory')->get('language.entity.fr')->get(); $this->assertEqual($language['langcode'], 'en'); @@ -65,7 +65,7 @@ function testLanguageConfiguration() { ); $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->assertOptionSelected('edit-site-default-language', 'fr', 'Default language updated.'); - $this->assertEqual($this->getUrl(), url('fr/admin/config/regional/settings', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('system.regional_settings', array(), array('absolute' => TRUE, 'langcode' => 'fr')), 'Correct page redirection.'); // Check if a valid language prefix is added after changing the default // language. diff --git a/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php index bbad439..834e778 100644 --- a/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php +++ b/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php @@ -44,7 +44,7 @@ public function testLanguageConfiguration() { $this->assertText(t('!name field is required.', array('!name' => t('Language name in English')))); $empty_language = new Language(); $this->assertFieldChecked('edit-direction-' . $empty_language->direction, 'Consistent usage of language direction.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language/add', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.add', array(), array('absolute' => TRUE)), 'Correct page redirection.'); // Test validation of invalid values. $edit = array( @@ -56,7 +56,7 @@ public function testLanguageConfiguration() { $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->assertRaw(t('%field may only contain characters a-z, underscores, or hyphens.', array('%field' => t('Language code')))); $this->assertRaw(t('%field cannot contain any markup.', array('%field' => t('Language name in English')))); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language/add', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.add', array(), array('absolute' => TRUE)), 'Correct page redirection.'); // Test validation of existing language values. $edit = array( @@ -72,7 +72,7 @@ public function testLanguageConfiguration() { 'The language %language has been created and can now be used.', array('%language' => $edit['label']) )); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), 'Correct page redirection.'); // Add the language a second time and confirm that this is not allowed. $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); @@ -80,6 +80,6 @@ public function testLanguageConfiguration() { 'The language %language (%langcode) already exists.', array('%language' => $edit['label'], '%langcode' => $edit['langcode']) )); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language/add', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.add', array(), array('absolute' => TRUE)), 'Correct page redirection.'); } } diff --git a/core/modules/language/src/Tests/LanguageListTest.php b/core/modules/language/src/Tests/LanguageListTest.php index 6ab92a7..2a5dd1f 100644 --- a/core/modules/language/src/Tests/LanguageListTest.php +++ b/core/modules/language/src/Tests/LanguageListTest.php @@ -41,7 +41,7 @@ function testLanguageList() { ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); $this->assertText('French', 'Language added successfully.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), 'Correct page redirection.'); // Add custom language. $langcode = 'xx'; @@ -53,7 +53,7 @@ function testLanguageList() { 'direction' => Language::DIRECTION_LTR, ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertRaw('"edit-languages-' . $langcode .'-weight"', 'Language code found.'); $this->assertText(t($name), 'Test language added.'); @@ -71,7 +71,7 @@ function testLanguageList() { // Ensure we can't delete the default language. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); - $this->assertEqual($this->getUrl(), url($langcode . '/admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => $langcode)), 'Correct page redirection.'); $this->assertText(t('The default language cannot be deleted.'), 'Failed to delete the default language.'); // Ensure 'Edit' link works. @@ -84,7 +84,7 @@ function testLanguageList() { ); $this->drupalPostForm('admin/config/regional/language/edit/' . $langcode, $edit, t('Save language')); $this->assertRaw($name, 'The language has been updated.'); - $this->assertEqual($this->getUrl(), url($langcode . '/admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => $langcode)), 'Correct page redirection.'); // Change back the default language. $edit = array( @@ -99,7 +99,7 @@ function testLanguageList() { $this->drupalGet('admin/config/regional/language/delete/' . $langcode); // First test the 'cancel' link. $this->clickLink(t('Cancel')); - $this->assertEqual($this->getUrl(), url('en/admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => 'en')), 'Correct page redirection.'); $this->assertRaw($name, 'The language was not deleted.'); // Delete the language for real. This a confirm form, we do not need any // fields changed. @@ -107,7 +107,7 @@ function testLanguageList() { // We need raw here because %language and %langcode will add HTML. $t_args = array('%language' => $name, '%langcode' => $langcode); $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.'); - $this->assertEqual($this->getUrl(), url('en/admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => 'en')), 'Correct page redirection.'); // Verify that language is no longer found. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); $this->assertResponse(404, 'Language no longer found.'); @@ -119,7 +119,7 @@ function testLanguageList() { // We need raw here because %language and %langcode will add HTML. $t_args = array('%language' => 'French', '%langcode' => 'fr'); $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The French language has been removed.'); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), 'Correct page redirection.'); // Verify that language is no longer found. $this->drupalGet('admin/config/regional/language/delete/fr'); $this->assertResponse(404, 'Language no longer found.'); @@ -137,7 +137,7 @@ function testLanguageList() { 'direction' => Language::DIRECTION_LTR, ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertText($name, 'Name found.'); // Check if we can change the default language. @@ -150,7 +150,7 @@ function testLanguageList() { ); $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->assertNoOptionSelected('edit-site-default-language', 'en', 'Default language updated.'); - $this->assertEqual($this->getUrl(), url($langcode . '/' . $path, array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => $langcode)), 'Correct page redirection.'); $this->drupalPostForm('admin/config/regional/language/delete/en', array(), t('Delete')); // We need raw here because %language and %langcode will add HTML. diff --git a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php index 4753539..8f32d13 100644 --- a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php @@ -417,7 +417,7 @@ function testLanguageDomain() { // Test URL in another language: http://it.example.com/admin. // Base path gives problems on the testbot, so $correct_link is hard-coded. // @see UrlAlterFunctionalTest::assertUrlOutboundAlter (path.test). - $italian_url = url('admin', array('language' => $languages['it'], 'script' => '')); + $italian_url = \Drupal::url('system.admin', array(), array('language' => $languages['it'], 'script' => '')); $url_scheme = \Drupal::request()->isSecure() ? 'https://' : 'http://'; $correct_link = $url_scheme . $link; $this->assertEqual($italian_url, $correct_link, format_string('The url() function returns the right URL (@url) in accordance with the chosen language', array('@url' => $italian_url))); @@ -426,7 +426,7 @@ function testLanguageDomain() { $this->settingsSet('mixed_mode_sessions', TRUE); $this->rebuildContainer(); - $italian_url = url('admin', array('https' => TRUE, 'language' => $languages['it'], 'script' => '')); + $italian_url = \Drupal::url('system.admin', array(), array('https' => TRUE, 'language' => $languages['it'], 'script' => '')); $correct_link = 'https://' . $link; $this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right HTTPS URL (via options) (@url) in accordance with the chosen language', array('@url' => $italian_url))); $this->settingsSet('mixed_mode_sessions', FALSE); @@ -435,7 +435,7 @@ function testLanguageDomain() { $request = Request::create('', 'GET', array(), array(), array(), array('HTTPS' => 'on')); $this->container->get('request_stack')->push($request); $generator = $this->container->get('url_generator'); - $italian_url = url('admin', array('language' => $languages['it'], 'script' => '')); + $italian_url = \Drupal::url('system.admin', array(), array('language' => $languages['it'], 'script' => '')); $correct_link = 'https://' . $link; $this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right URL (via current URL scheme) (@url) in accordance with the chosen language', array('@url' => $italian_url))); } diff --git a/core/modules/language/src/Tests/LanguageUrlRewritingTest.php b/core/modules/language/src/Tests/LanguageUrlRewritingTest.php index 4a4658f..c42dab6 100644 --- a/core/modules/language/src/Tests/LanguageUrlRewritingTest.php +++ b/core/modules/language/src/Tests/LanguageUrlRewritingTest.php @@ -77,7 +77,7 @@ function testUrlRewritingEdgeCases() { private function checkUrl($language, $message1, $message2) { $options = array('language' => $language, 'script' => ''); $base_path = trim(base_path(), '/'); - $rewritten_path = trim(str_replace($base_path, '', url('node', $options)), '/'); + $rewritten_path = trim(str_replace($base_path, '', \Drupal::url('view.frontpage.page_1', array(), $options)), '/'); $segments = explode('/', $rewritten_path, 2); $prefix = $segments[0]; $path = isset($segments[1]) ? $segments[1] : $prefix; @@ -118,7 +118,7 @@ function testDomainNameNegotiationPort() { // In case index.php is part of the URLs, we need to adapt the asserted // URLs as well. - $index_php = strpos(url('', array('absolute' => TRUE)), 'index.php') !== FALSE; + $index_php = strpos(\Drupal::url('', array(), array('absolute' => TRUE)), 'index.php') !== FALSE; $request = Request::createFromGlobals(); $server = $request->server->all(); @@ -126,7 +126,7 @@ function testDomainNameNegotiationPort() { // Create an absolute French link. $language = \Drupal::languageManager()->getLanguage('fr'); - $url = url('', array( + $url = \Drupal::url('', array(), array( 'absolute' => TRUE, 'language' => $language, )); @@ -136,7 +136,7 @@ function testDomainNameNegotiationPort() { $this->assertEqual($url, $expected, 'The right port is used.'); // If we set the port explicitly in url(), it should not be overriden. - $url = url('', array( + $url = \Drupal::url('', array(), array( 'absolute' => TRUE, 'language' => $language, 'base_url' => $request->getBaseUrl() . ':90', diff --git a/core/modules/locale/locale.batch.inc b/core/modules/locale/locale.batch.inc index b174074..67ce5d8 100644 --- a/core/modules/locale/locale.batch.inc +++ b/core/modules/locale/locale.batch.inc @@ -94,7 +94,7 @@ function locale_translation_batch_status_finished($success, $results) { if ($success) { if (isset($results['failed_files'])) { if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) { - $message = format_plural(count($results['failed_files']), 'One translation file could not be checked. See the log for details.', '@count translation files could not be checked. See the log for details.', array('@url' => url('admin/reports/dblog'))); + $message = format_plural(count($results['failed_files']), 'One translation file could not be checked. See the log for details.', '@count translation files could not be checked. See the log for details.', array('@url' => \Drupal::url('dblog.overview'))); } else { $message = format_plural(count($results['failed_files']), 'One translation files could not be checked. See the log for details.', '@count translation files could not be checked. See the log for details.'); diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index c9bf165..f1c48c6 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -350,7 +350,7 @@ function locale_translate_batch_finished($success, $results) { $additions = $updates = $deletes = $skips = $config = 0; if (isset($results['failed_files'])) { if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) { - $message = format_plural(count($results['failed_files']), 'One translation file could not be imported. See the log for details.', '@count translation files could not be imported. See the log for details.', array('@url' => url('admin/reports/dblog'))); + $message = format_plural(count($results['failed_files']), 'One translation file could not be imported. See the log for details.', '@count translation files could not be imported. See the log for details.', array('@url' => \Drupal::url('dblog.overview'))); } else { $message = format_plural(count($results['failed_files']), 'One translation file could not be imported. See the log for details.', '@count translation files could not be imported. See the log for details.'); @@ -381,7 +381,7 @@ function locale_translate_batch_finished($success, $results) { if ($skips) { if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) { - $message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => url('admin/reports/dblog'))); + $message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => \Drupal::url('dblog.overview'))); } else { $message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.'); diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 197eded..a9efce9 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -262,7 +262,7 @@ function locale_requirements($phase) { 'title' => 'Translation update status', 'value' => l(t('Updates available'), 'admin/reports/translations'), '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'))), + 'description' => t('Updates available for: @languages. See the Available translation updates page for more information.', array('@languages' => implode(', ', $available_updates), '@updates' => \Drupal::url('locale.translate_status'))), ); } else { @@ -270,7 +270,7 @@ function locale_requirements($phase) { 'title' => 'Translation update status', 'value' => t('Missing translations'), 'severity' => REQUIREMENT_INFO, - 'description' => t('Missing translations for: @languages. See the Available translation updates page for more information.', array('@languages' => implode(', ', $untranslated), '@updates' => url('admin/reports/translations'))), + 'description' => t('Missing translations for: @languages. See the Available translation updates page for more information.', array('@languages' => implode(', ', $untranslated), '@updates' => \Drupal::url('locale.translate_status'))), ); } } @@ -287,7 +287,7 @@ function locale_requirements($phase) { 'title' => 'Translation update status', 'value' => l(t('Can not determine status'), 'admin/reports/translations'), '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'))), + 'description' => t('No translation status is available. See the Available translation updates page for more information.', array('@updates' => \Drupal::url('locale.translate_status'))), ); } } diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index dc6043b..dd88364 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -33,7 +33,7 @@ function locale_translation_manual_status() { if (batch_get()) { return batch_process('admin/reports/translations'); } - return new RedirectResponse(url('admin/reports/translations', array('absolute' => TRUE))); + return new RedirectResponse(\Drupal::url('locale.translate_status', array(), array('absolute' => TRUE))); } /** diff --git a/core/modules/locale/src/Form/LocaleSettingsForm.php b/core/modules/locale/src/Form/LocaleSettingsForm.php index 0157d5e..1ff65a5 100644 --- a/core/modules/locale/src/Form/LocaleSettingsForm.php +++ b/core/modules/locale/src/Form/LocaleSettingsForm.php @@ -36,14 +36,14 @@ public function buildForm(array $form, FormStateInterface $form_state) { '7' => t('Weekly'), '30' => t('Monthly'), ), - '#description' => t('Select how frequently you want to check for new interface translations for your currently installed modules and themes. Check updates now.', array('@url' => url('admin/reports/translations/check'))), + '#description' => t('Select how frequently you want to check for new interface translations for your currently installed modules and themes. Check updates now.', array('@url' => \Drupal::url('locale.check_translation'))), ); if ($directory = $config->get('translation.path')) { - $description = t('Translation files are stored locally in the %path directory. You can change this directory on the File system configuration page.', array('%path' => $directory, '@url' => url('admin/config/media/file-system'))); + $description = t('Translation files are stored locally in the %path directory. You can change this directory on the File system configuration page.', array('%path' => $directory, '@url' => \Drupal::url('system.file_system_settings'))); } else { - $description = t('Translation files will not be stored locally. Change the Interface translation directory on the File system configuration page.', array('@url' => url('admin/config/media/file-system'))); + $description = t('Translation files will not be stored locally. Change the Interface translation directory on the File system configuration page.', array('@url' => \Drupal::url('system.file_system_settings'))); } $form['#translation_directory'] = $directory; $form['use_source'] = array( @@ -88,7 +88,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { parent::validateForm($form, $form_state); if (empty($form['#translation_directory']) && $form_state->getValue('use_source') == LOCALE_TRANSLATION_USE_SOURCE_LOCAL) { - $form_state->setErrorByName('use_source', $this->t('You have selected local translation source, but no Interface translation directory was configured.', array('@url' => url('admin/config/media/file-system')))); + $form_state->setErrorByName('use_source', $this->t('You have selected local translation source, but no Interface translation directory was configured.', array('@url' => \Drupal::url('system.file_system_settings')))); } } diff --git a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php index ff993ef..eac3b43 100644 --- a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php +++ b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php @@ -80,7 +80,7 @@ public function testStandalonePoFile() { $this->assert($locale_plurals['fr']['plurals'] == 2, 'Plural number initialized.'); // Ensure we were redirected correctly. - $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($this->getUrl(), \Drupal::url('locale.translate_page', array(), array('absolute' => TRUE)), 'Correct page redirection.'); // Try importing a .po file with invalid tags. $this->importPoFile($this->getBadPoFile(), array( @@ -90,7 +90,7 @@ public function testStandalonePoFile() { // The import should have created 1 string and rejected 2. $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.'); - $skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => url('admin/reports/dblog'))); + $skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => \Drupal::url('dblog.overview'))); $this->assertRaw($skip_message, 'Unsafe strings were skipped.'); // Repeat the process with a user that can access site reports, and this diff --git a/core/modules/search/search.module b/core/modules/search/search.module index eef49c5..0875260 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -92,7 +92,7 @@ function search_help($route_name, RouteMatchInterface $route_match) { return $output; case 'search.settings': - return '

' . t('The search engine maintains an index of words found in your site\'s content. To build and maintain this index, a correctly configured cron maintenance task is required. Indexing behavior can be adjusted using the settings below.', array('!cron' => url('admin/reports/status'))) . '

'; + return '

' . t('The search engine maintains an index of words found in your site\'s content. To build and maintain this index, a correctly configured cron maintenance task is required. Indexing behavior can be adjusted using the settings below.', array('!cron' => \Drupal::url('system.status'))) . '

'; } } diff --git a/core/modules/search/src/SearchPageListBuilder.php b/core/modules/search/src/SearchPageListBuilder.php index 5e6f1b5..5714f0a 100644 --- a/core/modules/search/src/SearchPageListBuilder.php +++ b/core/modules/search/src/SearchPageListBuilder.php @@ -202,7 +202,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('Number of items to index per cron run'), '#default_value' => $search_settings->get('index.cron_limit'), '#options' => $items, - '#description' => $this->t('The maximum number of items indexed in each pass of a cron maintenance task. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => url('admin/reports/status'))), + '#description' => $this->t('The maximum number of items indexed in each pass of a cron maintenance task. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => \Drupal::url('system.status'))), ); // Indexing settings: $form['indexing_settings'] = array( diff --git a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php index fe129f8..2f554c4 100644 --- a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php +++ b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php @@ -215,8 +215,8 @@ function testSearchModuleDisabling() { public function testDefaultSearchPageOrdering() { $this->drupalGet('search'); $elements = $this->xpath('//*[contains(@class, :class)]//a', array(':class' => 'tabs primary')); - $this->assertIdentical((string) $elements[0]['href'], url('search/node')); - $this->assertIdentical((string) $elements[1]['href'], url('search/user')); + $this->assertIdentical((string) $elements[0]['href'], \Drupal::url('search.view_node_search')); + $this->assertIdentical((string) $elements[1]['href'], \Drupal::url('search.view_user_search')); } /** diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 2df3a31..885b29f 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -39,7 +39,7 @@ function shortcut_help($route_name, RouteMatchInterface $route_match) { case 'entity.shortcut_set.edit_form': $user = \Drupal::currentUser(); if ($user->hasPermission('access shortcuts') && $user->hasPermission('switch shortcut sets')) { - $output = '

' . t('Define which shortcut set you are using on the Shortcuts tab of your account page.', array('@shortcut-link' => url("user/{$user->id()}/shortcuts"))) . '

'; + $output = '

' . t('Define which shortcut set you are using on the Shortcuts tab of your account page.', array('@shortcut-link' => \Drupal::url('shortcut.set_switch', array('user' => $user->id()))) . '

'; return $output; } } diff --git a/core/modules/simpletest/simpletest.install b/core/modules/simpletest/simpletest.install index 0094e53..4e5e01b 100644 --- a/core/modules/simpletest/simpletest.install +++ b/core/modules/simpletest/simpletest.install @@ -42,7 +42,7 @@ function simpletest_requirements($phase) { ); if (!$has_domdocument) { $requirements['php_domdocument']['severity'] = REQUIREMENT_ERROR; - $requirements['php_domdocument']['description'] = t('The testing framework requires the DOMDocument class to be available. Check the configure command at the PHP info page.', array('@link-phpinfo' => url('admin/reports/status/php'))); + $requirements['php_domdocument']['description'] = t('The testing framework requires the DOMDocument class to be available. Check the configure command at the PHP info page.', array('@link-phpinfo' => \Drupal::url('system.php'))); } // SimpleTest currently needs 2 cURL options which are incompatible with diff --git a/core/modules/simpletest/src/Form/SimpletestResultsForm.php b/core/modules/simpletest/src/Form/SimpletestResultsForm.php index 09abc1d..afc54e6 100644 --- a/core/modules/simpletest/src/Form/SimpletestResultsForm.php +++ b/core/modules/simpletest/src/Form/SimpletestResultsForm.php @@ -113,7 +113,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $test_id if (is_numeric($test_id) && !$results = $this->getResults($test_id)) { drupal_set_message($this->t('No test results to display.'), 'error'); - return new RedirectResponse(url('admin/config/development/testing', array('absolute' => TRUE))); + return new RedirectResponse(\Drupal::url('simpletest.test_form', array(), array('absolute' => TRUE))); } // Load all classes and include CSS. @@ -201,7 +201,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $test_id $form['result']['summary']['#ok'] = $form['result']['summary']['#fail'] + $form['result']['summary']['#exception'] == 0; // Actions. - $form['#action'] = url('admin/config/development/testing/results/re-run'); + $form['#action'] = \Drupal::url('simpletest.result_form', array('test_id' => 're-run')); $form['action'] = array( '#type' => 'fieldset', '#title' => $this->t('Actions'), diff --git a/core/modules/simpletest/src/Tests/BrowserTest.php b/core/modules/simpletest/src/Tests/BrowserTest.php index d744550..cceb865 100644 --- a/core/modules/simpletest/src/Tests/BrowserTest.php +++ b/core/modules/simpletest/src/Tests/BrowserTest.php @@ -22,7 +22,7 @@ function testGetAbsoluteUrl() { $url = 'user/login'; $this->drupalGet($url); - $absolute = url($url, array('absolute' => TRUE)); + $absolute = \Drupal::url('user.login', array(), array('absolute' => TRUE)); $this->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.'); $this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); @@ -31,8 +31,7 @@ function testGetAbsoluteUrl() { $this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); $this->clickLink('Create new account'); - $url = 'user/register'; - $absolute = url($url, array('absolute' => TRUE)); + $absolute = \Drupal::url('user.register', array(), array('absolute' => TRUE)); $this->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.'); $this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.'); } diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php index 4f1b2f1..1e90774 100644 --- a/core/modules/system/src/Controller/SystemController.php +++ b/core/modules/system/src/Controller/SystemController.php @@ -116,7 +116,7 @@ public static function create(ContainerInterface $container) { public function overview($link_id) { // Check for status report errors. if ($this->systemManager->checkRequirements() && $this->currentUser()->hasPermission('administer site configuration')) { - drupal_set_message($this->t('One or more problems were detected with your Drupal installation. Check the status report for more information.', array('@status' => url('admin/reports/status'))), 'error'); + drupal_set_message($this->t('One or more problems were detected with your Drupal installation. Check the status report for more information.', array('@status' => \Drupal::url('system.status'))), 'error'); } // Load all menu links below it. $parameters = new MenuTreeParameters(); diff --git a/core/modules/system/src/Form/CronForm.php b/core/modules/system/src/Form/CronForm.php index 14900ea..595d830 100644 --- a/core/modules/system/src/Form/CronForm.php +++ b/core/modules/system/src/Form/CronForm.php @@ -101,7 +101,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ); $form['cron_url'] = array( - '#markup' => '

' . t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . $this->state->get('system.cron_key'), array('absolute' => TRUE)))) . '

', + '#markup' => '

' . t('To run cron from outside the site, go to !cron', array('!cron' => \Drupal::url('system.cron', array('key' => $this->state->get('system.cron_key')), array('absolute' => TRUE)))) . '

', ); $form['cron'] = array( @@ -144,7 +144,7 @@ public function submitCron(array &$form, FormStateInterface $form_state) { drupal_set_message(t('Cron run failed.'), 'error'); } - return new RedirectResponse(url('admin/config/system/cron', array('absolute' => TRUE))); + return new RedirectResponse(\Drupal::url('system.cron_settings', array(), array('absolute' => TRUE))); } } diff --git a/core/modules/system/src/Form/PerformanceForm.php b/core/modules/system/src/Form/PerformanceForm.php index e42a6ae..11d04bf 100644 --- a/core/modules/system/src/Form/PerformanceForm.php +++ b/core/modules/system/src/Form/PerformanceForm.php @@ -140,7 +140,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $disabled = !$is_writable; $disabled_message = ''; if (!$is_writable) { - $disabled_message = ' ' . t('Set up the public files directory to make these optimizations available.', array('!file-system' => url('admin/config/media/file-system'))); + $disabled_message = ' ' . t('Set up the public files directory to make these optimizations available.', array('!file-system' => \Drupal::url('system.file_system_settings'))); } $form['bandwidth_optimization'] = array( diff --git a/core/modules/system/src/Form/SiteMaintenanceModeForm.php b/core/modules/system/src/Form/SiteMaintenanceModeForm.php index 1e400b3..24be993 100644 --- a/core/modules/system/src/Form/SiteMaintenanceModeForm.php +++ b/core/modules/system/src/Form/SiteMaintenanceModeForm.php @@ -63,7 +63,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'checkbox', '#title' => t('Put site into maintenance mode'), '#default_value' => $this->state->get('system.maintenance_mode'), - '#description' => t('Visitors will only see the maintenance mode message. Only users with the "Access site in maintenance mode" permission will be able to access the site. Authorized users can log in directly via the user login page.', array('@permissions-url' => url('admin/config/people/permissions'), '@user-login' => url('user'))), + '#description' => t('Visitors will only see the maintenance mode message. Only users with the "Access site in maintenance mode" permission will be able to access the site. Authorized users can log in directly via the user login page.', array('@permissions-url' => \Drupal::url('user.admin_permissions'), '@user-login' => \Drupal::url('user.login'))), ); $form['maintenance_mode_message'] = array( '#type' => 'textarea', diff --git a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php index 262be48..c206e7e 100644 --- a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php +++ b/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php @@ -57,7 +57,7 @@ function testPageCacheTags() { // Verify a cache hit, but also the presence of the correct cache tags. $this->drupalGet($path); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT'); - $cid_parts = array(url($path, array('absolute' => TRUE)), 'html'); + $cid_parts = array(\Drupal::url('system_test.cache_tags_page', array(), array('absolute' => TRUE)), 'html'); $cid = sha1(implode(':', $cid_parts)); $cache_entry = \Drupal::cache('render')->get($cid); sort($cache_entry->tags); diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 3c3020f..f1c9b23 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1178,7 +1178,7 @@ function hook_mail($key, &$message, $params) { $node = $params['node']; $variables += array( '%uid' => $node->getOwnerId(), - '%url' => url('node/' . $node->id(), array('absolute' => TRUE)), + '%url' => $node->url('canonical', array('absolute' => TRUE)), '%node_type' => node_get_type_label($node), '%title' => $node->getTitle(), '%teaser' => $node->teaser, @@ -1587,7 +1587,7 @@ function hook_requirements($phase) { ); } - $requirements['cron']['description'] .= ' ' . t('You can run cron manually.', array('@cron' => url('admin/reports/status/run-cron'))); + $requirements['cron']['description'] .= ' ' . t('You can run cron manually.', array('@cron' => \Drupal::url('system.run_cron'))); $requirements['cron']['title'] = t('Cron maintenance tasks'); } @@ -2350,7 +2350,7 @@ function hook_tokens($type, $tokens, array $data = array(), array $options = arr break; case 'edit-url': - $replacements[$original] = url('node/' . $node->id() . '/edit', $url_options); + $replacements[$original] = $node->url('edit-form', $url_options); break; // Default values for the chained tokens handled below. diff --git a/core/modules/system/system.install b/core/modules/system/system.install index b9c1b83..541ba9f 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -315,8 +315,8 @@ function system_requirements($phase) { $description = t('Cron has not run recently.') . ' ' . $help; } - $description .= ' ' . t('You can run cron manually.', array('@cron' => url('admin/reports/status/run-cron'))); - $description .= '
' . t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . \Drupal::state()->get('system.cron_key'), array('absolute' => TRUE)))); + $description .= ' ' . t('You can run cron manually.', array('@cron' => \Drupal::url('system.run_cron'))); + $description .= '
' . t('To run cron from outside the site, go to !cron', array('!cron' => \Drupal::url('system.cron', array('key' => \Drupal::state()->get('system.cron_key'), array('absolute' => TRUE))))); $requirements['cron'] = array( 'title' => t('Cron maintenance tasks'), diff --git a/core/modules/system/system.tokens.inc b/core/modules/system/system.tokens.inc index c6f6532..ff78335 100644 --- a/core/modules/system/system.tokens.inc +++ b/core/modules/system/system.tokens.inc @@ -120,11 +120,11 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a break; case 'url': - $replacements[$original] = url('', $url_options); + $replacements[$original] = \Drupal::url('', array(), $url_options); break; case 'url-brief': - $replacements[$original] = preg_replace(array('!^https?://!', '!/$!'), '', url('', $url_options)); + $replacements[$original] = preg_replace(array('!^https?://!', '!/$!'), '', \Drupal::url('', array(), $url_options)); break; case 'login-url': diff --git a/core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php b/core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php index 2152393..7802113 100644 --- a/core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php +++ b/core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php @@ -105,8 +105,8 @@ public static function settingsForm(FieldDefinitionInterface $field_definition) else { $form['view']['no_view_help'] = array( '#markup' => '

' . t('No eligible views were found. Create a view with an Entity Reference display, or add such a display to an existing view.', array( - '@create' => url('admin/structure/views/add'), - '@existing' => url('admin/structure/views'), + '@create' => \Drupal::url('views_ui.add'), + '@existing' => \Drupal::url('views_ui.list'), )) . '

', ); } diff --git a/core/modules/views/src/Plugin/views/display/Block.php b/core/modules/views/src/Plugin/views/display/Block.php index 544bd41..df21fe2 100644 --- a/core/modules/views/src/Plugin/views/display/Block.php +++ b/core/modules/views/src/Plugin/views/display/Block.php @@ -155,7 +155,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['block_category'] = array( '#type' => 'textfield', '#autocomplete_route_name' => 'block.category_autocomplete', - '#description' => t('The category this block will appear under on the blocks placement page.', array('@href' => url('admin/structure/block'))), + '#description' => t('The category this block will appear under on the blocks placement page.', array('@href' => \Drupal::url('block.admin_display'))), '#default_value' => $this->getOption('block_category'), ); break;