diff core/modules/user/src/ContextProvider/CurrentUserContext.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
line wrap: on
line diff
--- a/core/modules/user/src/ContextProvider/CurrentUserContext.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/core/modules/user/src/ContextProvider/CurrentUserContext.php	Mon Apr 23 09:46:53 2018 +0100
@@ -50,6 +50,12 @@
   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']);