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;
/**
* The text of the link.
*
* @var string
* 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.
* @var string|array|\Drupal\Component\Render\MarkupInterface
*/
protected $text;
@ -34,8 +37,12 @@ class Link implements RenderableInterface {
/**
* Constructs a new Link object.
*
* @param string $text
* The text of the link.
* @param string|array|\Drupal\Component\Render\MarkupInterface $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.
* @param \Drupal\Core\Url $url
* The url object.
*/
@ -49,6 +56,10 @@ class Link implements RenderableInterface {
*
* @param string|array|\Drupal\Component\Render\MarkupInterface $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.
* @param string $route_name
* The name of the route
* @param array $route_parameters
@ -66,8 +77,12 @@ class Link implements RenderableInterface {
/**
* Creates a Link object from a given Url object.
*
* @param string $text
* The text of the link.
* @param string|array|\Drupal\Component\Render\MarkupInterface $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.
* @param \Drupal\Core\Url $url
* The Url to create the link for.
*
@ -80,7 +95,12 @@ class Link implements RenderableInterface {
/**
* 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() {
return $this->text;
@ -89,8 +109,12 @@ class Link implements RenderableInterface {
/**
* Sets the new text of the link.
*
* @param string $text
* The new text.
* @param string|array|\Drupal\Component\Render\MarkupInterface $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
*/