function og_features_permission_features_export_render in Organic groups 7.2
Implements hook_Features_export_render().
File
- includes/
og_features_permission.features.inc, line 74 - Integration with features for og permissions.
Code
function og_features_permission_features_export_render($module, $data) {
$code = array();
$code[] = ' $permissions = array();';
$code[] = '';
$perms = _og_features_get_permissions();
foreach ($data as $key) {
list($group_type, $bundle, $perm) = explode(':', $key);
$permission = array();
if (!empty($perms[$group_type][$bundle][$perm]['roles'])) {
$roles = $perms[$group_type][$bundle][$perm]['roles'];
$permission['roles'] = array_combine($roles, $roles);
}
else {
$permission['roles'] = array();
}
// Ensure consistent ordering of roles on output to avoid extraneious diffs.
asort($permission['roles']);
$perm_identifier = features_var_export($key);
$perm_export = features_var_export($permission, ' ');
$code[] = " // Exported og permission: {$perm_identifier}";
$code[] = " \$permissions[{$perm_identifier}] = {$perm_export};";
$code[] = '';
}
$code[] = ' return $permissions;';
$code = implode("\n", $code);
return array(
'og_features_default_permissions' => $code,
);
}