Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295636

Make breadcrumb block cacheable

$
0
0

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

  1. \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
  2. Added a url.path cache context
  3. hook_breadcrumb_alter takes $breadcrumb object as a first parameter instead of an array.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue categoryTask, because nothing is broken.
Issue priorityMajor because cacheability of the breadcrumb block is important for performance. Currently it would make pages completely uncacheable, which is problematic for performance.
Prioritized changesthe main goal of this issue is performance and cacheability.
Disruption@todo Fill out

Viewing all articles
Browse latest Browse all 295636


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>