function Url::fromRoute
Same name in other branches
- 9 core/lib/Drupal/Core/Url.php \Drupal\Core\Url::fromRoute()
- 8.9.x core/lib/Drupal/Core/Url.php \Drupal\Core\Url::fromRoute()
- 10 core/lib/Drupal/Core/Url.php \Drupal\Core\Url::fromRoute()
Creates a new Url object for a URL that has a Drupal route.
This method is for URLs that have Drupal routes (that is, most pages generated by Drupal). For non-routed local URIs relative to the base path (like robots.txt) use Url::fromUri() with the base: scheme.
Parameters
string $route_name: The name of the route
array $route_parameters: (optional) An associative array of route parameter names and values.
array $options: See \Drupal\Core\Url::fromUri() for details.
Return value
static A new Url object for a routed (internal to Drupal) URL.
See also
\Drupal\Core\Url::fromUserInput()
416 calls to Url::fromRoute()
- AccessDeniedSubscriber::on403 in core/
modules/ user/ src/ EventSubscriber/ AccessDeniedSubscriber.php - Redirects users when access is denied.
- ActionFormAjaxTest::testActionConfigurationWithAjax in core/
modules/ action/ tests/ src/ FunctionalJavascript/ ActionFormAjaxTest.php - Tests action plugins with AJAX save their configuration.
- AjaxFileManagedMultipleTest::testMultipleFilesUpload in core/
modules/ file/ tests/ src/ FunctionalJavascript/ AjaxFileManagedMultipleTest.php - Tests if managed file form element works well with multiple files upload.
- AjaxFormCacheTest::testFormCacheUsage in core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ AjaxFormCacheTest.php - Tests the usage of form cache for AJAX forms.
- AjaxFormCacheTest::testQueryString in core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ AjaxFormCacheTest.php - Tests AJAX forms on pages with a query string.
File
-
core/
lib/ Drupal/ Core/ Url.php, line 153
Class
- Url
- Defines an object that holds information about a URL.
Namespace
Drupal\CoreCode
public static function fromRoute($route_name, $route_parameters = [], $options = []) {
return new static($route_name, $route_parameters, $options);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.