interface PathBasedGeneratorInterface

Defines an interface for generating a url from a path as opposed to a route.

Hierarchy

Expanded class hierarchy of PathBasedGeneratorInterface

All classes that implement PathBasedGeneratorInterface

1 file declares its use of PathBasedGeneratorInterface
PathSubscriber.php in drupal/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
Definition of Drupal\Core\EventSubscriber\PathSubscriber.

File

drupal/core/lib/Drupal/Core/Routing/PathBasedGeneratorInterface.php, line 15
Contains Drupal\Core\Routing\PathBasedGeneratorInterface.

Namespace

Drupal\Core\Routing
View source
interface PathBasedGeneratorInterface {

  /**
   * Generates an internal or external URL.
   *
   * @param $path
   *   (optional) The internal path or external URL being linked to, such as
   *   "node/34" or "http://example.com/foo".
   *
   * @param $options
   *   (optional) An associative array of additional options.
   *
   * @return
   *   A string containing a URL to the given path.
   */
  public function generateFromPath($path = NULL, $options = array());

  /**
   * Sets the $request property.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The HttpRequest object representing the current request.
   */
  public function setRequest(Request $request);

  /**
   * Sets the baseUrl property.
   *
   * This property is made up of scheme, host and base_path, e.g.
   *   'http://www.example.com/mydrupalinstall/'
   *
   * The base url is usually set by the request but we allow it to be set
   * independent of the request so that code that calls url() outside the context
   * of a request can use the global $base_url variable to set this value.
   *
   * @todo Remove this once the url() function no longer supports being called
   *   when there is no request.
   *
   * @var string $url
   *   The base url to use for url generation.
   */
  public function setBaseUrl($url);

  /**
   * Sets the basePath property.
   *
   * This will be either '/' or '[subdir]/', where [subdir] is the name of the
   * subdirectory that Drupal is running in.
   *
   * The base path is usually set by the request but we allow it to be set
   * independent of the request so that code that calls url() outside the context
   * of a request can use the global $base_url variable to set this value.
   *
   * @todo Remove this once the url() function no longer supports being called
   *   when there is no request.
   *
   * @var string $path
   *   The base path to use for url generation.
   */
  public function setBasePath($path);

  /**
   * Sets the scriptPath property.
   *
   * The script path is usually set by the request and is either 'index.php' or
   * the empty string, depending on whether the request path actually contains
   * the script path or not. We allow it to be set independent of the request so
   * that code that calls url() outside the context of a request can use the global
   * $script_path variable to set this value.
   *
   * @todo Remove this once the url() function no longer supports being called
   *   when there is no request.
   *
   * @var string $path
   *   The script path to use for url generation.
   */
  public function setScriptPath($path);

}

Members

Namesort descending Modifiers Type Description Overrides
PathBasedGeneratorInterface::generateFromPath public function Generates an internal or external URL. 1
PathBasedGeneratorInterface::setBasePath public function Sets the basePath property. 1
PathBasedGeneratorInterface::setBaseUrl public function Sets the baseUrl property. 1
PathBasedGeneratorInterface::setRequest public function Sets the $request property. 1
PathBasedGeneratorInterface::setScriptPath public function Sets the scriptPath property. 1