Breadcrumb::setLinks

public Breadcrumb::setLinks(array $links)

Sets the breadcrumb links.

Parameters

\Drupal\Core\Link[] $links: The breadcrumb links.

Return value

$this

Throws

\LogicException Thrown when setting breadcrumb links after they've already been set.

File

core/lib/Drupal/Core/Breadcrumb/Breadcrumb.php, line 44

Class

Breadcrumb
Used to return generated breadcrumbs with associated cacheability metadata.

Namespace

Drupal\Core\Breadcrumb

Code

1
2
3
4
5
6
7
8
9
public function setLinks(array $links) {
  if (!empty($this->links)) {
    throw new \LogicException('Once breadcrumb links are set, only additional breadcrumb links can be added.');
  }
 
  $this->links = $links;
 
  return $this;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.