From 1c7bca0b6f824dc99101802286a348dcfc71cd01 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Fri, 16 Oct 2009 03:47:14 +0000 Subject: #605442 by catch: Add a generic hook_entity_load(). --- includes/entity.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/entity.inc b/includes/entity.inc index e50cf6fb3..ba9175d9a 100644 --- a/includes/entity.inc +++ b/includes/entity.inc @@ -223,8 +223,9 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface { /** * Attach data to entities upon loading. * - * This will attach fields, if the entity is fieldable. It also calls - * hook_TYPE_load() on the loaded entities. For example + * This will attach fields, if the entity is fieldable. It calls + * hook_entity_load() for modules which need to add data to all entities. + * It also calls hook_TYPE_load() on the loaded entities. For example * hook_node_load() or hook_user_load(). If your hook_TYPE_load() * expects special parameters apart from the queried entities, you can set * $this->hookLoadArguments prior to calling the method. @@ -241,6 +242,11 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface { } } + // Call hook_entity_load(). + foreach (module_implements('entity_load') as $module) { + $function = $module . '_entity_load'; + $function($queried_entities, $this->entityType); + } // Call hook_TYPE_load(). The first argument for hook_TYPE_load() are // always the queried entities, followed by additional arguments set in // $this->hookLoadArguments. -- cgit v1.2.3