X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fuser%2Fsrc%2FContextProvider%2FCurrentUserContext.php;fp=web%2Fcore%2Fmodules%2Fuser%2Fsrc%2FContextProvider%2FCurrentUserContext.php;h=5e1756918ef2890846cec8f4f1a03c4e650ad1fd;hp=aacc5f774afbeb7ce9f4cc665895bb70cabe3e36;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/user/src/ContextProvider/CurrentUserContext.php b/web/core/modules/user/src/ContextProvider/CurrentUserContext.php index aacc5f774..5e1756918 100644 --- a/web/core/modules/user/src/ContextProvider/CurrentUserContext.php +++ b/web/core/modules/user/src/ContextProvider/CurrentUserContext.php @@ -4,9 +4,8 @@ namespace Drupal\user\ContextProvider; 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 @@ class CurrentUserContext implements ContextProviderInterface { $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);