Mercurial > hg > cmmr2012-drupal-site
diff core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php Thu May 09 15:34:47 2019 +0100 @@ -0,0 +1,31 @@ +<?php + +namespace Drupal\layout_builder\Cache; + +use Drupal\Core\Cache\Context\RouteNameCacheContext; + +/** + * Determines if an entity is being viewed in the Layout Builder UI. + * + * Cache context ID: 'route.name.is_layout_builder_ui'. + * + * @internal + * Tagged services are internal. + */ +class LayoutBuilderUiCacheContext extends RouteNameCacheContext { + + /** + * {@inheritdoc} + */ + public static function getLabel() { + return t('Layout Builder user interface'); + } + + /** + * {@inheritdoc} + */ + public function getContext() { + return 'is_layout_builder_ui.' . (int) (strpos($this->routeMatch->getRouteName(), 'layout_builder.') !== 0); + } + +}