Link
final class Link implements CacheableDependencyInterface (View source)
| internal | JSON:API maintains no PHP API. The API is the HTTP API. This class may change at any time and could break any dependencies on it. |
Represents an RFC8288 based link.
Traits
Trait for \Drupal\Core\Cache\CacheableDependencyInterface.
Properties
| protected string[] | $cacheContexts | Cache contexts. |
from CacheableDependencyTrait |
| protected string[] | $cacheTags | Cache tags. |
from CacheableDependencyTrait |
| protected int | $cacheMaxAge | Cache max-age. |
from CacheableDependencyTrait |
| protected Url | $uri | The link URI. |
|
| protected string | $href | The URI, as a string. |
|
| protected string[] | $rel | The link relation types. |
|
| protected string[] | $attributes | The link target attributes. |
Methods
$this
setCacheability(CacheableDependencyInterface $cacheability)
Sets cacheability; useful for value object constructors.
__construct(CacheableMetadata $cacheability, Url $url, string $link_relation_type, array $target_attributes = [])
JSON:API Link constructor.
string
getHref()
Gets the link's URI as a string.
string
getLinkRelationType()
Gets the link's relation type.
string[]
getTargetAttributes()
Gets the link's target attributes.
Details
protected $this
setCacheability(CacheableDependencyInterface $cacheability)
Sets cacheability; useful for value object constructors.
getCacheTags()
{@inheritdoc}
getCacheContexts()
{@inheritdoc}
getCacheMaxAge()
{@inheritdoc}
__construct(CacheableMetadata $cacheability, Url $url, string $link_relation_type, array $target_attributes = [])
JSON:API Link constructor.
Url
getUri()
Gets the link's URI.
string
getHref()
Gets the link's URI as a string.
string
getLinkRelationType()
Gets the link's relation type.
string[]
getTargetAttributes()
Gets the link's target attributes.