diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index 708c245..d64d927 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -191,11 +191,12 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode) { /** * Builds an entity's view; augments entity defaults. * - * This function is assigned as a #pre_render callback in ::view(). + * This method is assigned as a #pre_render callback in ::viewMultiple() for + * each entity. * - * It transforms the renderable array for a single entity to the same - * structure as if we were rendering multiple entities, and then calls the - * default ::buildMultiple() #pre_render callback. + * It transforms the renderable array for a single entity to a structure + * understood by EntityViewBuilder::buildMultiple(), which is currently not + * called directly. * * @param array $build * A renderable array containing build information and context for an entity @@ -204,7 +205,8 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode) { * @return array * The updated renderable array. * - * @see drupal_render() + * @see \Drupal\Core\Render\RendererInterface + * @see \Drupal\Core\Entity\EntityViewBuilder::buildMultiple() */ public function build(array $build) { $build_list = [$build]; @@ -215,11 +217,17 @@ public function build(array $build) { /** * Builds multiple entities' views; augments entity defaults. * - * This function is assigned as a #pre_render callback in ::viewMultiple(). + * This method is currently only called through EntityViewBuilder::build() + * as the render (cache) system does not support a #pre_render + * callback for multiple, separately cached render arrays. * - * By delaying the building of an entity until the #pre_render processing in - * drupal_render(), the processing cost of assembling an entity's renderable - * array is saved on cache-hit requests. + * @todo Either simplify this to remove support for building multiple entities + * at once or support a #pre_render_multiple or similar API in the render + * system. + * + * By delaying the building of an entity until the #pre_render processing, the + * processing cost of assembling an entity's renderable array is saved on + * cache-hit requests. * * @param array $build_list * A renderable array containing build information and context for an