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.
Hi All,
I have this issue and don't know how to figure out. Thank for this great module by the way.
field_collection
field_item1: which is of type linkfield
field_item2: which is of type computedfield
How can I get the actual url under field_item1 in field_item2?
I did this under Computed Code (PHP) of field_item2
$entity_field[0]['value'] = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_video_url')));
But it just print out a:0:{}, not the actual url enter under field_item1.
Thanks
Comments
Comment #1
truyenle CreditAttribution: truyenle commentedI think I got it.
Instead of
$entity_field[0]['value'] = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_video_url')));
It should be
$entity_field[0]['value'] = array_pop(field_get_items($entity_type, $entity, 'field_video_url'))['url'];
Thanks
Comment #2
jmuzz CreditAttribution: jmuzz commented