Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -7,15 +7,17 @@
|
|||
|
||||
namespace Drupal\Core\Breadcrumb;
|
||||
|
||||
use Drupal\Core\Cache\CacheableMetadata;
|
||||
use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
|
||||
use Drupal\Core\Cache\RefinableCacheableDependencyTrait;
|
||||
use Drupal\Core\Link;
|
||||
use Drupal\Core\Render\RenderableInterface;
|
||||
|
||||
/**
|
||||
* Used to return generated breadcrumbs with associated cacheability metadata.
|
||||
*
|
||||
* @todo implement RenderableInterface once https://www.drupal.org/node/2529560 lands.
|
||||
*/
|
||||
class Breadcrumb extends CacheableMetadata {
|
||||
class Breadcrumb implements RenderableInterface, RefinableCacheableDependencyInterface {
|
||||
|
||||
use RefinableCacheableDependencyTrait;
|
||||
|
||||
/**
|
||||
* An ordered list of links for the breadcrumb.
|
||||
|
@ -68,4 +70,24 @@ class Breadcrumb extends CacheableMetadata {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toRenderable() {
|
||||
$build = [
|
||||
'#cache' => [
|
||||
'contexts' => $this->cacheContexts,
|
||||
'tags' => $this->cacheTags,
|
||||
'max-age' => $this->cacheMaxAge,
|
||||
],
|
||||
];
|
||||
if (!empty($this->links)) {
|
||||
$build += [
|
||||
'#theme' => 'breadcrumb',
|
||||
'#links' => $this->links,
|
||||
];
|
||||
}
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue