diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-01-13 05:00:25 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-01-13 05:00:25 +0000 |
commit | 3a0f6b33720b1a939ec2f828bfefd31b6c51817f (patch) | |
tree | 89502c07e46b8eb5367aa880c74a15204c95c2cc /modules/system | |
parent | 52f99dc071428a1490d0d367e95706a65f5b3d17 (diff) | |
download | brdo-3a0f6b33720b1a939ec2f828bfefd31b6c51817f.tar.gz brdo-3a0f6b33720b1a939ec2f828bfefd31b6c51817f.tar.bz2 |
#636992 by catch, yched: Fixed Entity loading needs protection from infinite recursion. Prevents unnecessary user_load()s from RDF.
Diffstat (limited to 'modules/system')
-rw-r--r-- | modules/system/system.api.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php index f78556c4c..f8f20b8cc 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -264,6 +264,28 @@ function hook_admin_paths_alter(&$paths) { } /** + * Act on entities as they are being prepared for view. + * + * Allows you to operate on multiple entities as they are being prepared for + * view. Only use this if attaching the data during the entity_load() phase + * is not appropriate, for example when attaching other 'entity' style objects. + * + * @param $entities + * The entities keyed by entity ID. + * @param $type + * The type of entities being loaded (i.e. node, user, comment). + */ +function hook_entity_prepare_view($entities, $type) { + // Load a specific node into the user object for later theming. + if ($type == 'user') { + $nodes = mymodule_get_user_nodes(array_keys($entities)); + foreach ($entities as $uid => $entity) { + $entity->user_node = $nodes[$uid]; + } + } +} + +/** * Perform periodic actions. * * This hook will only be called if cron.php is run (e.g. by crontab). |