Mercurial > hg > isophonics-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
48 * {@inheritdoc} | 48 * {@inheritdoc} |
49 */ | 49 */ |
50 public function getRuntimeContexts(array $unqualified_context_ids) { | 50 public function getRuntimeContexts(array $unqualified_context_ids) { |
51 $current_user = $this->userStorage->load($this->account->id()); | 51 $current_user = $this->userStorage->load($this->account->id()); |
52 | 52 |
53 if ($current_user) { | |
54 // @todo Do not validate protected fields to avoid bug in TypedData, | |
55 // remove this in https://www.drupal.org/project/drupal/issues/2934192. | |
56 $current_user->_skipProtectedUserFieldConstraint = TRUE; | |
57 } | |
58 | |
53 $context = new Context(new ContextDefinition('entity:user', $this->t('Current user')), $current_user); | 59 $context = new Context(new ContextDefinition('entity:user', $this->t('Current user')), $current_user); |
54 $cacheability = new CacheableMetadata(); | 60 $cacheability = new CacheableMetadata(); |
55 $cacheability->setCacheContexts(['user']); | 61 $cacheability->setCacheContexts(['user']); |
56 $context->addCacheableDependency($cacheability); | 62 $context->addCacheableDependency($cacheability); |
57 | 63 |