Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. if($fc_fields != false){
  2. // Extract the field collection item ids
  3. $ids = array();
  4. foreach ($fc_fields as $fc_field) {
  5. $ids[] = $fc_field['value'];
  6. }
  7. }
  8.  
  9. // Get the field collection items.
  10. $fc_fields = field_get_items('node', $node, 'field_field_collection_field');
  11.  
  12. // Extract the field collection item ids
  13. $ids = array();
  14. foreach ($fc_fields as $fc_field) {
  15. $ids[] = $fc_field['value'];
  16. }
  17.  
  18. // Load up the field collection items
  19. $items = field_collection_item_load_multiple($ids);
  20.  
  21. // Loop through the items and extract field values
  22. foreach ($items as $item) {
  23. $link_fields = field_get_items('field_collection_item', $item, 'field_link');
  24. $link = array_shift($link_fields);
  25. $url = $link['url'];
  26.  
  27. $site_name_fields = field_get_items('field_collection_item', $item, 'field_site_name');
  28. $site_name = array_shift($site_name_fields);
  29. $name = $site_name['value'];
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement