7.x field.api.php hook_field_attach_load($entity_type, $entities, $age, $options)

Act on field_attach_load().

This hook is invoked after the field module has performed the operation.

Unlike other field_attach hooks, this hook accounts for 'multiple loads'. Instead of the usual $entity parameter, it accepts an array of entities, indexed by entity ID. For performance reasons, information for all available entities should be loaded in a single query where possible.

The changes made to the entities' field values get cached by the field cache for subsequent loads.

See field_attach_load() for details and arguments.

Related topics

1 invocation of hook_field_attach_load()
field_attach_load in modules/field/field.attach.inc
Loads fields for the current revisions of a group of entities.


modules/field/field.api.php, line 1315
Hooks provided by the Field module.


function hook_field_attach_load($entity_type, $entities, $age, $options) {

  // @todo Needs function body.


rszrama’s picture

Note that in the event of a field deletion, this hook will be invoked with a set of stub entities instead of fully loaded entities. Therefore if you're using this hook to manipulate existing field data on entities, you should ensure the field actually exists on the entities passed in before operating on it to avoid warnings / errors.

ivanjaros’s picture

Be aware that this hook is totally useless for dynamic code!!!!! It runs only once and then the output/changes get's cached and dynamic stuff does not work anymore.