[support] D7: Loading full objects attached with Field API?
Georg Jaehnig
georg at jaehnig.org
Sun Sep 30 23:01:59 UTC 2012
Hi,
On Sat, Sep 29, 2012 at 5:40 PM, Hadubard <hadubard at gmail.com> wrote:
> I'd say you could simply call user_load($user->uid).
No, it eventually also calls entity_load_single("user", $user->uid);
> If that doesn't do the trick have a look at field_attach_load().
Yeah, also tried that:
http://api.drupal.org/api/drupal/modules%21field%21field.attach.inc/function/field_attach_load/7
"field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT,
$options = array())
Loads fields for the current revisions of a group of entities.
Loads all fields for each entity object in a group of a single entity
type. The loaded field values are added directly to the entity
objects."
... but it does nothing here. And I actually can't see how this
"loaded field values are added directly to the entity objects" shall
happen, as you don't pass $entities as a reference. So how could the
function change $entites?
> Btw: I consider it bad practice to overwrite the global $user object.
Oh right, yeah, good point!
--
Georg | http://serchilo.net - command the web
More information about the support
mailing list