class Breadcrumb implements RenderableInterface, RefinableCacheableDependencyInterface (View source)

Used to return generated breadcrumbs with associated cacheability metadata.

Traits

Trait for \Drupal\Core\Cache\RefinableCacheableDependencyInterface.

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
$links

An ordered list of links for the breadcrumb.

Methods

$this
setCacheability(CacheableDependencyInterface $cacheability)

Sets cacheability; useful for value object constructors.

getCacheTags()

{@inheritdoc}

addCacheableDependency($other_object)

{@inheritdoc}

addCacheContexts(array $cache_contexts)

{@inheritdoc}

addCacheTags(array $cache_tags)

{@inheritdoc}

Link[]
getLinks()

Gets the breadcrumb links.

$this
setLinks(array $links)

Sets the breadcrumb links.

$this
addLink(Link $link)

Appends a link to the end of the ordered list of breadcrumb links.

array
toRenderable()

Returns a render array representation of the object.

Details

protected $this setCacheability(CacheableDependencyInterface $cacheability)

Sets cacheability; useful for value object constructors.

Parameters

CacheableDependencyInterface $cacheability

The cacheability to set.

Return Value

$this

getCacheTags()

{@inheritdoc}

getCacheContexts()

{@inheritdoc}

getCacheMaxAge()

{@inheritdoc}

addCacheableDependency($other_object)

{@inheritdoc}

Parameters

$other_object

addCacheContexts(array $cache_contexts)

{@inheritdoc}

Parameters

array $cache_contexts

addCacheTags(array $cache_tags)

{@inheritdoc}

Parameters

array $cache_tags

mergeCacheMaxAge($max_age)

{@inheritdoc}

Parameters

$max_age

Gets the breadcrumb links.

Return Value

Link[]

Sets the breadcrumb links.

Parameters

array $links

The breadcrumb links.

Return Value

$this

Exceptions

LogicException

Appends a link to the end of the ordered list of breadcrumb links.

Parameters

Link $link

The link appended to the breadcrumb.

Return Value

$this

array toRenderable()

Returns a render array representation of the object.

Return Value

array

A render array.