Skip to main content
2 of 2
added 30 characters in body
Anil Sagar
  • 12.2k
  • 2
  • 31
  • 54

Great Question :-) After re-engineering Field UI module found a simple way to retrieve above details...

  $bundle = field_extract_bundle('field_collection_item', 'field_my_collection_fields');

  $instances = field_info_instances('field_collection_item', $bundle);


  foreach ($instances as $field_name => $field_properties) {
   if ($field_properties['required'] == 1) {
     drupal_set_message($field_name . " is  required");
   }
   else {
     drupal_set_message($field_name . " is  not required");
   }
  }

Replace field_my_collection_fields with your field collection field name in above code ...

Anil Sagar
  • 12.2k
  • 2
  • 31
  • 54