Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using the Entity Reference module (http://drupal.org/project/entityreference) and want a computed field that stores a list of entity references from multiple fields, so that I can filter against the computed field in a view. However, with the following code:
$entity_field[0]['value'] = "array_pop(array_pop(field_get_items($entity_type, $entity, 'field_a')))";
$entity_field[1]['value'] = "array_pop(array_pop(field_get_items($entity_type, $entity, 'field_b')))";
$entity_field[1]['value'] = "array_pop(array_pop(field_get_items($entity_type, $entity, 'field_c')))";
I get the following error:
Recoverable fatal error: Object of class stdClass could not be converted to string in eval() (line 1 of /.../sites/all/modules/computed_field/computed_field.module(466) : eval()'d code).
Is there a way of doing this, or is Computed Field not presently compatible with Entity Reference fields?