function user_permission_features_export_render in Features 6
Same name and namespace in other branches
- 7.2 includes/features.user.inc \user_permission_features_export_render()
- 7 includes/features.user.inc \user_permission_features_export_render()
Implementation of hook_features_export_render().
File
- includes/
features.user.inc, line 80
Code
function user_permission_features_export_render($module, $data) {
$code = array();
$code[] = ' $permissions = array();';
$code[] = '';
$permissions = _user_features_get_permissions();
foreach ($data as $perm_name) {
$permission = array();
$permission['name'] = $perm_name;
if (!empty($permissions[$perm_name])) {
sort($permissions[$perm_name]);
$permission['roles'] = drupal_map_assoc($permissions[$perm_name]);
}
else {
$permission['roles'] = array();
}
$perm_identifier = features_var_export($perm_name);
$perm_export = features_var_export($permission, ' ');
$code[] = " // Exported permission: {$perm_name}";
$code[] = " \$permissions[{$perm_identifier}] = {$perm_export};";
$code[] = "";
}
$code[] = ' return $permissions;';
$code = implode("\n", $code);
return array(
'user_default_permissions' => $code,
);
}