Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Link.php

function Link::fromTextAndUrl

Creates a Link object from a given Url object.

Parameters

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.

\Drupal\Core\Url $url: The Url to create the link for.

Return value

static

6 calls to Link::fromTextAndUrl()
claro_preprocess_admin_block_content in core/themes/claro/claro.theme
Implements template_preprocess_HOOK() for admin_block.
claro_preprocess_block_content_add_list in core/themes/claro/claro.theme
Implements template_preprocess_HOOK() for block_content_add_list.
claro_preprocess_node_add_list in core/themes/claro/claro.theme
Implements template_preprocess_HOOK() for node_add_list.
ImageFormatter::settingsForm in core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
Returns a form to configure settings for the formatter.
ImageUrlFormatter::settingsForm in core/modules/image/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php
Returns a form to configure settings for the formatter.

... See full list

File

core/lib/Drupal/Core/Link.php, line 93

Class

Link
Defines an object that holds information about a link.

Namespace

Drupal\Core

Code

public static function fromTextAndUrl($text, Url $url) {
    return new static($text, $url);
}
RSS feed
Powered by Drupal