You are here

interface UrlGeneratorInterface in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/routing/Generator/UrlGeneratorInterface.php \Symfony\Component\Routing\Generator\UrlGeneratorInterface
  2. 8 core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php \Drupal\Core\Routing\UrlGeneratorInterface
Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php \Drupal\Core\Routing\UrlGeneratorInterface

Defines an interface for generating a url from a route or system path.

Provides additional methods and options not present in the base interface.

Hierarchy

Expanded class hierarchy of UrlGeneratorInterface

All classes that implement UrlGeneratorInterface

13 files declare their use of UrlGeneratorInterface
AccessDeniedSubscriber.php in core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
Contains \Drupal\user\EventSubscriber\AccessDeniedSubscriber.
BlockContentBlock.php in core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
Contains \Drupal\block_content\Plugin\Block\BlockContentBlock.
CommentManager.php in core/modules/comment/src/CommentManager.php
Contains \Drupal\comment\CommentManager.
FormSubmitter.php in core/lib/Drupal/Core/Form/FormSubmitter.php
Contains \Drupal\Core\Form\FormSubmitter.
FormSubmitterTest.php in core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php
Contains \Drupal\Tests\Core\Form\FormSubmitterTest.

... See full list

File

core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php, line 17
Contains \Drupal\Core\Routing\UrlGeneratorInterface.

Namespace

Drupal\Core\Routing
View source
interface UrlGeneratorInterface extends VersatileGeneratorInterface {

  /**
   * Gets the internal path (system path) for a route.
   *
   * @param string|\Symfony\Component\Routing\Route $name
   *  The route name or a route object.
   * @param array $parameters
   *  An array of parameters as passed to
   *  \Symfony\Component\Routing\Generator\UrlGeneratorInterface::generate().
   *
   * @return string
   *  The internal Drupal path corresponding to the route.
   */
  public function getPathFromRoute($name, $parameters = array());

  /**
   * Generates a URL or path for a specific route based on the given parameters.
   *
   * Parameters that reference placeholders in the route pattern will be
   * substituted for them in the pattern. Extra params are added as query
   * strings to the URL.
   *
   * @param string|\Symfony\Component\Routing\Route $name
   *   The route name or a route object.
   * @param array  $parameters
   *   An associative array of parameter names and values.
   * @param array $options
   *   (optional) An associative array of additional options, with the following
   *   elements:
   *   - 'query': An array of query key/value-pairs (without any URL-encoding)
   *     to append to the URL.
   *   - 'fragment': A fragment identifier (named anchor) to append to the URL.
   *     Do not include the leading '#' character.
   *   - 'absolute': Defaults to FALSE. Whether to force the output to be an
   *     absolute link (beginning with http:). Useful for links that will be
   *     displayed outside the site, such as in an RSS feed.
   *   - 'language': An optional language object used to look up the alias
   *     for the URL. If $options['language'] is omitted, it defaults to the
   *     current language for the language type LanguageInterface::TYPE_URL.
   *   - 'https': Whether this URL should point to a secure location. If not
   *     defined, the current scheme is used, so the user stays on HTTP or HTTPS
   *     respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
   *   - 'base_url': Only used internally by a path processor, for example, to
   *     modify the base URL when a language dependent URL requires so.
   *   - 'prefix': Only used internally, to modify the path when a language
   *     dependent URL requires so.
   * @param bool $collect_bubbleable_metadata
   *   (optional) Defaults to FALSE. When TRUE, both the generated URL and its
   *   associated bubbleable metadata are returned.
   *
   * @return string|\Drupal\Core\GeneratedUrl
   *   The generated URL for the given route.
   *   When $collect_bubbleable_metadata is TRUE, a GeneratedUrl object is
   *   returned, containing the generated URL plus bubbleable metadata.
   *
   * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException
   *   Thrown when the named route does not exist.
   * @throws \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
   *   Thrown when some parameters are missing that are mandatory for the route.
   * @throws \Symfony\Component\Routing\Exception\InvalidParameterException
   *   Thrown when a parameter value for a placeholder is not correct because it
   *   does not match the requirement.
   *
   * @internal
   *   Should not be used in user code.
   *   Use \Drupal\Core\Url instead.
   */
  public function generateFromRoute($name, $parameters = array(), $options = array(), $collect_bubbleable_metadata = FALSE);

}

Members

Namesort descending Modifiers Type Description Overrides
RequestContextAwareInterface::getContext public function Gets the request context. 9
RequestContextAwareInterface::setContext public function Sets the request context. 9
UrlGeneratorInterface::ABSOLUTE_PATH constant Generates an absolute path, e.g. "/dir/file".
UrlGeneratorInterface::ABSOLUTE_URL constant Generates an absolute URL, e.g. "http://example.com/dir/file".
UrlGeneratorInterface::generate public function Generates a URL or path for a specific route based on the given parameters. 8
UrlGeneratorInterface::generateFromRoute public function Generates a URL or path for a specific route based on the given parameters. 3
UrlGeneratorInterface::getPathFromRoute public function Gets the internal path (system path) for a route. 3
UrlGeneratorInterface::NETWORK_PATH constant Generates a network path, e.g. "//example.com/dir/file". Such reference reuses the current scheme but specifies the host.
UrlGeneratorInterface::RELATIVE_PATH constant Generates a relative path based on the current request path, e.g. "../parent-file".
VersatileGeneratorInterface::getRouteDebugMessage public function Convert a route identifier (name, content object etc) into a string usable for logging and other debug/error messages 5
VersatileGeneratorInterface::supports public function Whether this generator supports the supplied $name. 5