Skip to content
PHP Ecosystem
Explore

Link

API reference › HTML › Metadata › Link

Renders the HTML <link> element for relationships to external resources.

See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link (BaseVoid for the base implementation.).

PropertyTypeDescriptionDefined by
$attributes protectedmixed[]HTML attributes array used by the implementing class. Default: [].UIAwesome\Html\Mixin\HasAttributes
MethodDescriptionDefined by
__construct() finalInitializes a new tag instance.UIAwesome\Html\Core\Base\BaseTag
__toString()Returns the rendered tag string.UIAwesome\Html\Core\Base\BaseTag
accesskey()Sets the accesskey attribute.UIAwesome\Html\Attribute\Global\HasAccesskey
addAriaAttribute()Sets an aria-* attribute.UIAwesome\Html\Attribute\Global\HasAria
addAttribute()Adds or updates a single HTML attribute for the element.UIAwesome\Html\Mixin\HasAttributes
addDataAttribute()Sets a data-* attribute.UIAwesome\Html\Attribute\Global\HasData
addEvent()Sets an on* event attribute.UIAwesome\Html\Attribute\Global\HasEvents
ariaAttributes()Sets multiple aria-* attributes.UIAwesome\Html\Attribute\Global\HasAria
as()Sets the as attribute.UIAwesome\Html\Attribute\HasAs
attributes()Adds or updates multiple HTML attributes for the element.UIAwesome\Html\Mixin\HasAttributes
blocking()Sets the blocking attribute.UIAwesome\Html\Attribute\HasBlocking
class()Sets the class attribute.UIAwesome\Html\Attribute\Global\HasClass
config()Applies application-scoped config recipes to this tag.UIAwesome\Html\Core\Base\BaseTag
crossorigin()Sets the crossorigin attribute.UIAwesome\Html\Attribute\HasCrossorigin
dataAttributes()Sets multiple data-* attributes.UIAwesome\Html\Attribute\Global\HasData
dir()Sets the dir attribute.UIAwesome\Html\Attribute\Global\HasDir
disabled()Sets the disabled attribute.UIAwesome\Html\Attribute\CanBeDisabled
events()Sets multiple on* event attributes.UIAwesome\Html\Attribute\Global\HasEvents
fetchpriority()Sets the fetchpriority attribute.UIAwesome\Html\Attribute\HasFetchpriority
getAttribute()Returns the value of a single HTML attribute.UIAwesome\Html\Mixin\HasAttributes
getAttributes()Returns the array of HTML attributes for the element.UIAwesome\Html\Mixin\HasAttributes
hidden()Sets the hidden attribute.UIAwesome\Html\Attribute\Global\CanBeHidden
href()Sets the href attribute.Link
hreflang()Sets the hreflang attribute.UIAwesome\Html\Attribute\HasHreflang
id()Sets the id attribute.UIAwesome\Html\Attribute\Global\HasId
imagesizes()Sets the imagesizes attribute.UIAwesome\Html\Attribute\HasImageSizes
imagesrcset()Sets the imagesrcset attribute.UIAwesome\Html\Attribute\HasImageSrcSet
integrity()Sets the integrity attribute.UIAwesome\Html\Attribute\HasIntegrity
lang()Sets the lang attribute.UIAwesome\Html\Attribute\Global\HasLang
media()Sets the media attribute.UIAwesome\Html\Attribute\HasMedia
referrerpolicy()Sets the referrerpolicy attribute.UIAwesome\Html\Attribute\HasReferrerpolicy
rel()Sets the rel attribute.UIAwesome\Html\Attribute\HasRel
removeAriaAttribute()Removes an aria-* attribute.UIAwesome\Html\Attribute\Global\HasAria
removeAttribute()Removes a specific HTML attribute from the element.UIAwesome\Html\Mixin\HasAttributes
removeDataAttribute()Removes a data-* attribute.UIAwesome\Html\Attribute\Global\HasData
removeEvent()Removes an on* event attribute.UIAwesome\Html\Attribute\Global\HasEvents
render() finalRenders the tag with lifecycle hooks.UIAwesome\Html\Core\Base\BaseTag
replaceAttributes()Replaces all HTML attributes for the element.UIAwesome\Html\Mixin\HasAttributes
role()Sets the role attribute.UIAwesome\Html\Attribute\Global\HasRole
sizes()Sets the sizes attribute.UIAwesome\Html\Attribute\HasSizes
style()Sets the style attribute.UIAwesome\Html\Attribute\Global\HasStyle
tag() staticCreates and configures a new tag instance.UIAwesome\Html\Core\Base\BaseTag
title()Sets the title attribute.UIAwesome\Html\Attribute\Global\HasTitle
translate()Sets the translate attribute.UIAwesome\Html\Attribute\Global\HasTranslate
type()Sets the type attribute.Link
afterRun() protectedPost-processes rendered output.UIAwesome\Html\Core\Event\HasAfterRun
beforeRun() protectedValidates state before rendering.UIAwesome\Html\Core\Event\HasBeforeRun
getTag() protectedReturns the tag enumeration for the <link> element.Link
loadDefault() protectedReturns class-level default definitions.UIAwesome\Html\Core\Base\BaseTag
run() protectedRenders the void element.UIAwesome\Html\Core\Element\BaseVoid
public function href(string|Stringable|UnitEnum|null $value): static

Sets the href attribute.

Parameters

ParameterTypeDescription
$valuestring|Stringable|UnitEnum|nullURL, path, or fragment, or null to remove the attribute.

Returns

static: New instance with the updated href attribute.

public function type(string|Stringable|UnitEnum|null $value): static

Sets the type attribute.

Hints at the MIME type of the linked resource. Any MIME type is accepted; browsers treat the value as an advisory hint and fetch the resource regardless.

Parameters

ParameterTypeDescription
$valuestring|Stringable|UnitEnum|nullMIME type of the linked resource, or null to remove the attribute.

Returns

static: New instance with the updated type attribute.

See also

protected function getTag(): UIAwesome\Html\Interop\MetadataVoid

Returns the tag enumeration for the <link> element.

Returns

MetadataVoid: Tag enumeration instance for <link>. MetadataVoid for valid metadata void tags.