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(). --- modules/system/system.api.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'modules/system/system.api.php') diff --git a/modules/system/system.api.php b/modules/system/system.api.php index d29a16035..f6b9be1ef 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -149,6 +149,23 @@ function hook_entity_info_alter(&$entity_info) { $entity_info['node']['controller class'] = 'MyCustomNodeController'; } +/** + * Act on entities when loaded. + * + * This is a generic load hook called for all entity types loaded via the + * entity API. + * + * @param $entities + * The entities keyed by entity ID. + * @param $type + * The type of entities being loaded (i.e. node, user, comment). + */ +function hook_entity_load($entities, $type) { + foreach ($entities as $entity) { + $entity->foo = mymodule_add_something($entity, $entity_type); + } +} + /** * Perform periodic actions. * -- cgit v1.2.3