From aa9211a6c1dde873842eff53ab288f03ab8fdf53 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 26 Apr 2016 13:48:18 +0100 Subject: [PATCH] =?UTF-8?q?Issue=20#2700415=20by=20nicolas.rafaelli,=20dim?= =?UTF-8?q?aro,=20rashid=5F786,=20er.pushpinderrana,=20korgik,=20David=20H?= =?UTF-8?q?ern=C3=A1ndez,=20jhodgdon:=20Problems=20with=20documentation=20?= =?UTF-8?q?of=20options=20in=20Url=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Drupal/Core/Url.php | 52 +++++++++++++----------------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 6908bc81b1bb..0f5b4e501b64 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -55,6 +55,8 @@ class Url { /** * The URL options. * + * See \Drupal\Core\Url::fromUri() for details on the options. + * * @var array */ protected $options = array(); @@ -101,21 +103,7 @@ class Url { * @param array $route_parameters * (optional) 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. Merged with the parameters array. - * - '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. + * See \Drupal\Core\Url::fromUri() for details. * * @see static::fromRoute() * @see static::fromUri() @@ -141,21 +129,7 @@ class Url { * @param array $route_parameters * (optional) An associative array of route parameter names and values. * @param array $options - * (optional) An associative array of additional URL options, with the - * following elements: - * - 'query': An array of query key/value-pairs (without any URL-encoding) - * to append to the URL. Merged with the parameters array. - * - '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. + * See \Drupal\Core\Url::fromUri() for details. * * @return \Drupal\Core\Url * A new Url object for a routed (internal to Drupal) URL. @@ -265,6 +239,9 @@ class Url { * - '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. + * - 'attributes': An associative array of HTML attributes that will be + * added to the anchor tag if you use the \Drupal\Core\Link class to make + * the link. * - '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. @@ -348,7 +325,7 @@ class Url { * Parts from an URI of the form entity:{entity_type}/{entity_id} as from * parse_url(). * @param array $options - * An array of options, see static::fromUri() for details. + * An array of options, see \Drupal\Core\Url::fromUri() for details. * @param string $uri * The original entered URI. * @@ -400,7 +377,7 @@ class Url { * @param array $uri_parts * Parts from an URI of the form internal:{path} as from parse_url(). * @param array $options - * An array of options, see static::fromUri() for details. + * An array of options, see \Drupal\Core\Url::fromUri() for details. * * @return \Drupal\Core\Url * A new Url object for a 'internal:' URI. @@ -447,7 +424,7 @@ class Url { * from parse_url(), where the path is the route name optionally followed by * a ";" followed by route parameters in key=value format with & separators. * @param array $options - * An array of options, see static::fromUri() for details. + * An array of options, see \Drupal\Core\Url::fromUri() for details. * @param string $uri * The original passed in URI. * @@ -638,6 +615,8 @@ class Url { * Returns the URL options. * * @return array + * The array of options. See \Drupal\Core\Url::fromUri() for details on what + * it contains. */ public function getOptions() { return $this->options; @@ -646,6 +625,8 @@ class Url { /** * Gets a specific option. * + * See \Drupal\Core\Url::fromUri() for details on the options. + * * @param string $name * The name of the option. * @@ -664,7 +645,8 @@ class Url { * Sets the URL options. * * @param array $options - * The array of options. + * The array of options. See \Drupal\Core\Url::fromUri() for details on what + * it contains. * * @return $this */ @@ -676,6 +658,8 @@ class Url { /** * Sets a specific option. * + * See \Drupal\Core\Url::fromUri() for details on the options. + * * @param string $name * The name of the option. * @param mixed $value