public function GroupTypeController::export in Group 7
Export a group type.
Exports a group type and its group roles.
Overrides EntityAPIControllerExportable::export
File
- classes/
group_type.controller.inc, line 129 - Defines the Entity API CRUD class for group types.
Class
- GroupTypeController
- Controller for group type entities.
Code
public function export($group_type, $prefix = '') {
// Only add special export logic on existing entities. Features likes to
// run on-the-fly entities through GroupTypeController::export(), which
// may cause issues when determining the feature's state.
if (empty($group_type->is_new)) {
// Get the GroupRole controller.
$controller = entity_get_controller('group_role');
// Add an empty array to always have the 'roles' property on exports.
$group_type->roles = array();
// Add group roles to the group type.
foreach ($group_type
->getRoles(FALSE) as $group_role) {
// Global group roles are never exported along with a group type.
if ($group_role->global) {
continue;
}
$group_type->roles[] = drupal_json_decode($controller
->export($group_role, $prefix));
}
}
return parent::export($group_type, $prefix);
}