You are here

function globallink_get_allparent_fc in GlobalLink Connect for Drupal 7.7

Same name and namespace in other branches
  1. 7.6 globallink.module \globallink_get_allparent_fc()
1 call to globallink_get_allparent_fc()
globallink_form_field_ui_field_edit_form_submit in ./globallink.module
Update field config for modified bundle field.

File

./globallink.module, line 967
GlobalLink translation module.

Code

function globallink_get_allparent_fc($entity_type, $bundle_name, $field_name, $content_types, $parents = array()) {
  $all_field_collections = array();
  foreach ($content_types as $content_type) {
    $parent_cts = globallink_get_all_content_types_for_field($content_type, 'field_collection');
    foreach ($parent_cts as $parent_ct) {
      if (globallink_check_field_configured($parent_ct, $entity_type, $bundle_name, $field_name)) {
        continue;
      }
      if (!in_array($parent_ct, $parents)) {
        $parents[] = $parent_ct;
      }
      $field_info = field_info_field($parent_ct);
      if ($field_info['type'] == 'field_collection') {
        $all_field_collections[] = $parent_ct;
      }
    }
  }
  if (count($all_field_collections) > 0) {
    $parents = globallink_get_allparent_fc($entity_type, $bundle_name, $field_name, $all_field_collections, $parents);
    return $parents;
  }
  return $parents;
}