diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 5f46020..7cb9f2d 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -41,7 +41,6 @@ function entity_get_info($entity_type = NULL) { */ function entity_info_cache_clear() { drupal_static_reset('entity_get_view_modes'); - drupal_static_reset('entity_get_bundles'); // Clear all languages. Drupal::entityManager()->clearCachedDefinitions(); Drupal::entityManager()->clearCachedFieldDefinitions(); diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 551c6dd..a74a918 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -129,6 +129,16 @@ public function __construct(\Traversable $namespaces, ContainerInterface $contai } /** + * {@inheritdoc} + */ + public function clearCachedDefinitions() { + parent::clearCachedDefinitions(); + + $this->bundleInfo = NULL; + } + + + /** * Checks whether a certain entity type has a certain controller. * * @param string $entity_type @@ -487,7 +497,7 @@ public function getBundleInfo($entity_type) { */ public function getAllBundleInfo() { if (!isset($this->bundleInfo)) { - $langcode = $this->languageManager->getLanguage(Language::TYPE_INTERFACE)->langcode; + $langcode = $this->languageManager->getLanguage(Language::TYPE_INTERFACE)->id; if ($cache = $this->cache->get("entity_bundle_info:$langcode")) { $this->bundleInfo = $cache->data; } @@ -495,8 +505,8 @@ public function getAllBundleInfo() { $this->bundleInfo = $this->moduleHandler->invokeAll('entity_bundle_info'); // If no bundles are provided, use the entity type name and label. foreach ($this->getDefinitions() as $type => $entity_info) { - if (!isset($bundles[$type])) { - $bundles[$type][$type]['label'] = $entity_info['label']; + if (!isset($this->bundleInfo[$type])) { + $this->bundleInfo[$type][$type]['label'] = $entity_info['label']; } } $this->moduleHandler->alter('entity_bundle_info', $this->bundleInfo);