interface BreadcrumbBuilderInterface

Same name in other branches
  1. 9 core/lib/Drupal/Core/Breadcrumb/BreadcrumbBuilderInterface.php \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface
  2. 8.9.x core/lib/Drupal/Core/Breadcrumb/BreadcrumbBuilderInterface.php \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface
  3. 10 core/lib/Drupal/Core/Breadcrumb/BreadcrumbBuilderInterface.php \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface

Defines an interface for classes that build breadcrumbs.

Hierarchy

Expanded class hierarchy of BreadcrumbBuilderInterface

All classes that implement BreadcrumbBuilderInterface

7 files declare their use of BreadcrumbBuilderInterface
BookBreadcrumbBuilder.php in core/modules/book/src/BookBreadcrumbBuilder.php
CommentBreadcrumbBuilder.php in core/modules/comment/src/CommentBreadcrumbBuilder.php
ForumBreadcrumbBuilderBase.php in core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
HelpBreadcrumbBuilder.php in core/modules/help/src/HelpBreadcrumbBuilder.php
PathBasedBreadcrumbBuilder.php in core/modules/system/src/PathBasedBreadcrumbBuilder.php

... See full list

File

core/lib/Drupal/Core/Breadcrumb/BreadcrumbBuilderInterface.php, line 10

Namespace

Drupal\Core\Breadcrumb
View source
interface BreadcrumbBuilderInterface {
    
    /**
     * Whether this breadcrumb builder should be used to build the breadcrumb.
     *
     * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
     *   The current route match.
     * phpcs:disable Drupal.Commenting
     * @todo Uncomment new method parameters before drupal:12.0.0, see
     *   https://www.drupal.org/project/drupal/issues/3459277.
     *
     * @param \Drupal\Core\Cache\CacheableMetadata $cacheable_metadata
     *   The cacheable metadata to add to if your check varies by or depends
     *   on something. Anything you specify here does not have to be repeated in
     *   the build() method as it will be merged in automatically.
     * phpcs:enable
     *
     * @return bool
     *   TRUE if this builder should be used or FALSE to let other builders
     *   decide.
     */
    public function applies(RouteMatchInterface $route_match);
    
    /**
     * Builds the breadcrumb.
     *
     * There is no need to add any cacheable metadata that was already added in
     * applies() as that will be automatically added for you.
     *
     * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
     *   The current route match.
     *
     * @return \Drupal\Core\Breadcrumb\Breadcrumb
     *   A breadcrumb.
     */
    public function build(RouteMatchInterface $route_match);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
BreadcrumbBuilderInterface::applies public function Whether this breadcrumb builder should be used to build the breadcrumb. 8
BreadcrumbBuilderInterface::build public function Builds the breadcrumb. 7

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.