diff -u b/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php --- b/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -47,7 +47,7 @@ * * @var array */ - protected $bundleExtraFields = array(); + protected $extraFields = array(); /** * The injection container that should be passed into the controller factory. @@ -139,7 +139,7 @@ * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. * @param \Drupal\Core\Cache\CacheBackendInterface $cache - * The generic cache backend to use. + * The cache backend to use. * @param \Drupal\Core\Language\LanguageManager $language_manager * The language manager. * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager @@ -170,6 +170,7 @@ $this->bundleInfo = NULL; $this->displayModeInfo = array(); + $this->extraFields = array(); } /** @@ -529,8 +530,8 @@ */ public function getExtraFields($entity_type_id, $bundle) { // Read from the "static" cache. - if (isset($this->bundleExtraFields[$entity_type_id][$bundle])) { - return $this->bundleExtraFields[$entity_type_id][$bundle]; + if (isset($this->extraFields[$entity_type_id][$bundle])) { + return $this->extraFields[$entity_type_id][$bundle]; } // Read from the persistent cache. Since hook_entity_extra_field_info() and @@ -539,8 +540,8 @@ $cache_id = 'entity_bundle_extra_fields:' . $entity_type_id . ':' . $bundle . ':' . $this->languageManager->getCurrentLanguage()->id; $cached = $this->cache->get($cache_id); if ($cached) { - $this->bundleExtraFields[$entity_type_id][$bundle] = $cached->data; - return $this->bundleExtraFields[$entity_type_id][$bundle]; + $this->extraFields[$entity_type_id][$bundle] = $cached->data; + return $this->extraFields[$entity_type_id][$bundle]; } $extra = $this->moduleHandler->invokeAll('entity_extra_field_info'); @@ -552,12 +553,12 @@ ); // Store in the 'static' and persistent caches. - $this->bundleExtraFields[$entity_type_id][$bundle] = $info; + $this->extraFields[$entity_type_id][$bundle] = $info; $this->cache->set($cache_id, $info, Cache::PERMANENT, array( 'entity_field_info' => TRUE, )); - return $this->bundleExtraFields[$entity_type_id][$bundle]; + return $this->extraFields[$entity_type_id][$bundle]; } /** diff -u b/core/modules/system/entity.api.php b/core/modules/system/entity.api.php --- b/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -820,6 +820,7 @@ * (\Drupal\Core\Field\FieldItemListInterface). */ function hook_entity_field_access_alter(array &$grants, array $context) { + /** @var \Drupal\Core\Field\FieldDefinitionInterface $field_definition */ $field_definition = $context['field_definition']; if ($field_definition->getName() == 'field_of_interest' && $grants['node'] === FALSE) { // Override node module's restriction to no opinion. We don't want to @@ -842,7 +843,6 @@ * (\Drupal\Core\Field\FieldItemListInterface). */ function hook_entity_field_access_alter(array &$grants, array $context) { - /** @var \Drupal\Core\Field\FieldDefinitionInterface $field_definition */ $field_definition = $context['field_definition']; if ($field_definition->getName() == 'field_of_interest' && $grants['node'] === FALSE) { // Override node module's restriction to no opinion. We don't want to