function field_test_field_test_op_multiple
Generic op to test _field_invoke_multiple behavior.
This simulates a multiple field operation callback to be invoked by _field_invoke_multiple().
File
-
modules/
field/ tests/ field_test.module, line 88
Code
function field_test_field_test_op_multiple($entity_type, $entities, $field, $instances, $langcode, &$items) {
$result = array();
foreach ($entities as $id => $entity) {
// Entities, instances and items are assumed to be consistently grouped by
// language. To verify this we try to access all the passed data structures
// by entity id. If they are grouped correctly, one entity, one instance and
// one array of items should be available for each entity id.
$field_name = $instances[$id]['field_name'];
$result[$id] = array(
$langcode => hash('sha256', serialize(array(
$entity_type,
$entity,
$field_name,
$langcode,
$items[$id],
))),
);
}
return $result;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.