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=aacc5f774afbeb7ce9f4cc665895bb70cabe3e36;hp=e9eccd8190b18ac3de2a94cd446ad08b3bf1a987;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/user/src/ContextProvider/CurrentUserContext.php b/web/core/modules/user/src/ContextProvider/CurrentUserContext.php index e9eccd819..aacc5f774 100644 --- a/web/core/modules/user/src/ContextProvider/CurrentUserContext.php +++ b/web/core/modules/user/src/ContextProvider/CurrentUserContext.php @@ -50,6 +50,12 @@ class CurrentUserContext implements ContextProviderInterface { public function getRuntimeContexts(array $unqualified_context_ids) { $current_user = $this->userStorage->load($this->account->id()); + if ($current_user) { + // @todo Do not validate protected fields to avoid bug in TypedData, + // remove this in https://www.drupal.org/project/drupal/issues/2934192. + $current_user->_skipProtectedUserFieldConstraint = TRUE; + } + $context = new Context(new ContextDefinition('entity:user', $this->t('Current user')), $current_user); $cacheability = new CacheableMetadata(); $cacheability->setCacheContexts(['user']);