1 field_test.module | field_test_field_test_op_multiple($entity_type, $entities, $field, $instances, $langcode, &$items) |
Generic op to test _field_invoke_multiple behavior.
This simulates a multiple field operation callback to be invoked by _field_invoke_multiple().
File
- core/
modules/ field/ tests/ field_test/ field_test.module, line 87 - Helper module for the Field API tests.
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;
}