diff core/modules/user/src/ContextProvider/CurrentUserContext.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children af1871eacc83
line wrap: on
line diff
--- a/core/modules/user/src/ContextProvider/CurrentUserContext.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/modules/user/src/ContextProvider/CurrentUserContext.php	Thu Feb 28 13:21:36 2019 +0000
@@ -4,9 +4,8 @@
 
 use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Plugin\Context\Context;
-use Drupal\Core\Plugin\Context\ContextDefinition;
 use Drupal\Core\Plugin\Context\ContextProviderInterface;
+use Drupal\Core\Plugin\Context\EntityContext;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 
@@ -56,7 +55,7 @@
       $current_user->_skipProtectedUserFieldConstraint = TRUE;
     }
 
-    $context = new Context(new ContextDefinition('entity:user', $this->t('Current user')), $current_user);
+    $context = EntityContext::fromEntity($current_user, $this->t('Current user'));
     $cacheability = new CacheableMetadata();
     $cacheability->setCacheContexts(['user']);
     $context->addCacheableDependency($cacheability);