function globallink_insert_fc_item_fields in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.7 globallink_field_configuration.inc \globallink_insert_fc_item_fields()
- 7.5 globallink_field_configuration.inc \globallink_insert_fc_item_fields()
Inserts field collection item fields.
Parameters
string $content_type: The content type.
string $parent_field_name: The parent's field name.
string $field_name: The field name.
1 call to globallink_insert_fc_item_fields()
- globallink_insert_fc_fields in ./
globallink_field_configuration.inc - Inserts field collection fields.
File
- ./
globallink_field_configuration.inc, line 556 - globallink_field_configuration.inc is a file that contains most functions needed on the Field Configuration UI.
Code
function globallink_insert_fc_item_fields($content_type, $parent_field_name, $field_name) {
$fc_field_info = field_info_field($field_name);
$fc_field_instance = field_info_instance('field_collection_item', $field_name, $parent_field_name);
switch ($fc_field_info['type']) {
case 'list_boolean':
case 'file':
case 'list_integer':
case 'taxonomy_term_reference':
break;
case 'field_collection':
db_insert('globallink_field_config')
->fields(array(
'content_type' => $content_type,
'entity_type' => 'field_collection_item',
'bundle' => $parent_field_name,
'field_name' => $field_name,
'field_type' => $fc_field_info['type'],
'field_label' => $fc_field_instance['label'],
'translatable' => 1,
))
->execute();
$fc_field_infos = field_info_instances('field_collection_item');
if (isset($fc_field_infos) && isset($fc_field_infos[$field_name]) && is_array($fc_field_infos[$field_name])) {
$fc_items = array_keys($fc_field_infos[$field_name]);
foreach ($fc_items as $fc_item) {
if (globallink_is_field_configured_for_translation('field_collection_item', $field_name, $fc_item, $content_type)) {
continue;
}
globallink_insert_fc_item_fields($content_type, $field_name, $fc_item);
}
}
break;
default:
$translatable = 1;
db_insert('globallink_field_config')
->fields(array(
'content_type' => $content_type,
'entity_type' => 'field_collection_item',
'bundle' => $parent_field_name,
'field_name' => $field_name,
'field_type' => $fc_field_info['type'],
'field_label' => $fc_field_instance['label'],
'translatable' => $translatable,
))
->execute();
}
}