Issue #3163487 by sudiptadas19, IT-Cru, raman.b, idebr, dawehner: Breadcrumb: $title could be an array, but Link() requires a string

(cherry picked from commit 07905362b2)
merge-requests/674/head
Lee Rowlands 2021-05-12 20:11:06 +10:00
parent 7d63c1f7e4
commit 393a419bca
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
1 changed files with 34 additions and 10 deletions

View File

@ -18,9 +18,12 @@ class Link implements RenderableInterface {
protected $linkGenerator; protected $linkGenerator;
/** /**
* The text of the link. * The link text for the anchor tag as a translated string or render array.
* * Strings will be sanitized automatically. If you need to output HTML in
* @var string * the link text, use a render array or an already sanitized string such as
* the output of \Drupal\Component\Utility\Xss::filter() or
* \Drupal\Component\Render\FormattableMarkup.
* @var string|array|\Drupal\Component\Render\MarkupInterface
*/ */
protected $text; protected $text;
@ -34,8 +37,12 @@ class Link implements RenderableInterface {
/** /**
* Constructs a new Link object. * Constructs a new Link object.
* *
* @param string $text * @param string|array|\Drupal\Component\Render\MarkupInterface $text
* The text of the link. * The link text for the anchor tag as a translated string or render array.
* Strings will be sanitized automatically. If you need to output HTML in
* the link text, use a render array or an already sanitized string such as
* the output of \Drupal\Component\Utility\Xss::filter() or
* \Drupal\Component\Render\FormattableMarkup.
* @param \Drupal\Core\Url $url * @param \Drupal\Core\Url $url
* The url object. * The url object.
*/ */
@ -49,6 +56,10 @@ class Link implements RenderableInterface {
* *
* @param string|array|\Drupal\Component\Render\MarkupInterface $text * @param string|array|\Drupal\Component\Render\MarkupInterface $text
* The link text for the anchor tag as a translated string or render array. * The link text for the anchor tag as a translated string or render array.
* Strings will be sanitized automatically. If you need to output HTML in
* the link text, use a render array or an already sanitized string such as
* the output of \Drupal\Component\Utility\Xss::filter() or
* \Drupal\Component\Render\FormattableMarkup.
* @param string $route_name * @param string $route_name
* The name of the route * The name of the route
* @param array $route_parameters * @param array $route_parameters
@ -66,8 +77,12 @@ class Link implements RenderableInterface {
/** /**
* Creates a Link object from a given Url object. * Creates a Link object from a given Url object.
* *
* @param string $text * @param string|array|\Drupal\Component\Render\MarkupInterface $text
* The text of the link. * The link text for the anchor tag as a translated string or render array.
* Strings will be sanitized automatically. If you need to output HTML in
* the link text, use a render array or an already sanitized string such as
* the output of \Drupal\Component\Utility\Xss::filter() or
* \Drupal\Component\Render\FormattableMarkup.
* @param \Drupal\Core\Url $url * @param \Drupal\Core\Url $url
* The Url to create the link for. * The Url to create the link for.
* *
@ -80,7 +95,12 @@ class Link implements RenderableInterface {
/** /**
* Returns the text of the link. * Returns the text of the link.
* *
* @return string * @return string|array|\Drupal\Component\Render\MarkupInterface
* The link text for the anchor tag as a translated string or render array.
* Strings will be sanitized automatically. If you need to output HTML in
* the link text, use a render array or an already sanitized string such as
* the output of \Drupal\Component\Utility\Xss::filter() or
* \Drupal\Component\Render\FormattableMarkup.
*/ */
public function getText() { public function getText() {
return $this->text; return $this->text;
@ -89,8 +109,12 @@ class Link implements RenderableInterface {
/** /**
* Sets the new text of the link. * Sets the new text of the link.
* *
* @param string $text * @param string|array|\Drupal\Component\Render\MarkupInterface $text
* The new text. * The link text for the anchor tag as a translated string or render array.
* Strings will be sanitized automatically. If you need to output HTML in
* the link text, use a render array or an already sanitized string such as
* the output of \Drupal\Component\Utility\Xss::filter() or
* \Drupal\Component\Render\FormattableMarkup.
* *
* @return $this * @return $this
*/ */