field_group.features.inc in Field Group 7.2
File
field_group.features.inc
View source
<?php
function field_group_features_export_alter(&$export, $module_name) {
ctools_include('export');
$field_groups = ctools_export_load_object('field_group');
if (!empty($export['features']['field'])) {
foreach ($export['features']['field'] as $field) {
list($entity_type, $bundle, $field_name) = explode('-', $field);
foreach ($field_groups as $group_id => $group) {
if ($group->entity_type == $entity_type && $group->bundle == $bundle && in_array($field_name, $group->data['children'])) {
$export['features']['field_group'][$group_id] = $group_id;
}
}
}
}
if (!empty($export['features']['field_group'])) {
foreach ($export['features']['field_group'] as $id) {
$group = isset($field_groups[$id]) ? $field_groups[$id] : FALSE;
if ($group && !empty($group->parent_name)) {
$parent_id = $group->parent_name . '|' . $group->entity_type . '|' . $group->bundle . '|' . $group->mode;
$parent_group = isset($field_groups[$parent_id]) ? $field_groups[$parent_id] : FALSE;
if ($parent_group && !isset($export['features']['field_group'][$parent_id])) {
$export['features']['field_group'][$parent_id] = $parent_id;
}
}
}
if (empty($export['dependencies']['field_group'])) {
$export['dependencies']['field_group'] = 'field_group';
}
}
}