Problem/Motivation
From SystemBreadcrumbBlock
:
<?php
/**
* {@inheritdoc}
*
* @todo Make cacheable as part of https://drupal.org/node/1805054
*/
public function getCacheMaxAge() {
return 0;
}
?>
Proposed resolution
Once #1805054: Cache localized, access filtered, URL resolved, and rendered menu trees lands, doing this becomes possible.
But, it doesn't make sense to fix it as part of that issue, because it requires analyzing and potentially updating all BreadcrumbBuilderInterface
implementations, of which there are about half a dozen. That interface may need to be changed as well.
Therefore, it should be done in a separate issue.
Update BreadcrumbBuilderInterface
so it allows cacheability metadata to be returned for the built breadcrumbs, and analyze all existing BreadcrumbBuilderInterface
implementations to have the correct cacheability.
Remaining tasks
None.
User interface changes
None.
API changes
\Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface::build()
needs to return a Breadcrumb object (or NULL?) that can encapsulate what it is returning in HEAD plus cacheability metadata- Added a url.path cache context
- hook_breadcrumb_alter takes $breadcrumb object as a first parameter instead of an array.
Beta phase evaluation
Issue category | Task, because nothing is broken. |
---|---|
Issue priority | Major because cacheability of the breadcrumb block is important for performance. Currently it would make pages completely uncacheable, which is problematic for performance. |
Prioritized changes | the main goal of this issue is performance and cacheability. |
Disruption | @todo Fill out |