diff -u b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php --- b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php @@ -30,9 +30,9 @@ public function viewElements(FieldItemListInterface $items) { $elements = array(); - // The 'language' cache context is not necessary, because - // \Drupal\Core\Language\LanguageInterface::getName() always returns the - // human-readable English name. + // The 'language' cache context is not necessary, because what is printed + // here is the language's name in English, not in the language of the + // response. foreach ($items as $delta => $item) { $elements[$delta] = array('#markup' => $item->language ? String::checkPlain($item->language->getName()) : ''); } diff -u b/core/lib/Drupal/Core/Render/RendererInterface.php b/core/lib/Drupal/Core/Render/RendererInterface.php --- b/core/lib/Drupal/Core/Render/RendererInterface.php +++ b/core/lib/Drupal/Core/Render/RendererInterface.php @@ -72,20 +72,31 @@ * provided by the children is typically inserted into the markup generated by * the parent array. * - * An important aspect of rendering is the bubbling of rendering metadata: - * cache contexts, cache tags, attached assets and #post_render_cache metadata - * all need to be bubbled up. That information is needed once the rendering to - * a HTML string is completed: we must know the bubbled cache contexts to be - * able to calculate the correct cache ID for render caching, the the - * resulting HTML for the page must know by which cache tags it should be - * invalidated, which (CSS and JavaScript) assets must be loaded, and which - * #post_render_cache callbacks should be executed. A stack data structure is - * used to perform this bubbling. + * An important aspect of rendering is caching the result, when appropriate. + * Because the HTML of a rendered item includes all of the HTML of the + * rendered children, caching it requires certain information to bubble up + * from child elements to their parents: + * - Cache contexts, so that the render cache is varied by every context that + * affects the rendered HTML. Because cache contexts affect the cache ID, + * and therefore must be resolved for cache hits as well as misses, it is + * up to the implementation of this interface to decide how to implement + * the caching of items whose children specify cache contexts not directly + * specified by the parent. \Drupal\Core\Render\Renderer implements this + * with a lazy two-tier caching strategy. Alternate strategies could be to + * not cache such parents at all or to cache them with the child elements + * replaced by placeholder tokens that are dynamically rendered after cache + * retrieval. + * - Cache tags, so that cached renderings are invalidated when site content + * or configuration that can affect that rendering changes. + * - #post_render_cache callbacks, for executing code to handle dynamic + * requirements that cannot be cached. + * A stack of \Drupal\Core\Render\BubbleableMetadata objects can be used to + * perform this bubbling. * - * Another important aspect is render caching. A two-tier caching approach - * (i.e. with one cache item redirecting to another one) to make render - * caching compatible with the bubbling of cache contexts, because cache - * contexts affect the cache ID. + * Additionally, whether retrieving from cache or not, it is important to + * know all of the assets (CSS and JavaScript) required by the rendered HTML, + * and this must also bubble from child to parent. Therefore, + * \Drupal\Core\Render\BubbleableMetadata includes that data as well. * * The process of rendering an element is recursive unless the element defines * an implemented theme hook in #theme. During each call to diff -u b/core/modules/node/src/Tests/NodeCacheTagsTest.php b/core/modules/node/src/Tests/NodeCacheTagsTest.php --- b/core/modules/node/src/Tests/NodeCacheTagsTest.php +++ b/core/modules/node/src/Tests/NodeCacheTagsTest.php @@ -43,15 +43,7 @@ } /** - * Returns the additional (non-standard) cache contexts for the tested entity. - * - * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity to be tested, as created by createEntity(). - * - * @return string[] - * An array of the additional cache contexts. - * - * @see \Drupal\system\Tests\Entity\EntityCacheTagsTestBase::createEntity() + * {@inheritdoc} */ protected function getAdditionalCacheContextsForEntity(EntityInterface $entity) { return ['timezone'];