hook_entity_build_defaults_alter

hook_entity_build_defaults_alter(array &$build, \Drupal\Core\Entity\EntityInterface $entity, $view_mode)

Alter entity renderable values before cache checking in drupal_render().

The values in the #cache key of the renderable array are used to determine if a cache entry exists for the entity's rendered output. Ideally only values that pertain to caching should be altered in this hook.

Parameters

array &$build: A renderable array containing the entity's caching and view mode values.

\Drupal\Core\Entity\EntityInterface $entity: The entity that is being viewed.

string $view_mode: The view_mode that is to be used to display the entity.

See also

drupal_render()

\Drupal\Core\Entity\EntityViewBuilder

hook_ENTITY_TYPE_build_defaults_alter()

Related topics

Entity CRUD, editing, and view hooks
Hooks used in various entity operations.
Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 1510
Hooks and documentation related to entities.

Code

function hook_entity_build_defaults_alter(array &$build, \Drupal\Core\Entity\EntityInterface $entity, $view_mode) {

}
doc_Drupal
2016-10-29 09:17:55
Comments
Leave a Comment

Please login to continue.