function user_permission_configuration_export_render in Configuration Management 7
Implements hook_configuration_export_render().
2 calls to user_permission_configuration_export_render()
File
- includes/
configuration.user.inc, line 67
Code
function user_permission_configuration_export_render($module, $data) {
$perm_modules =& drupal_static(__FUNCTION__ . '_perm_modules');
if (!isset($perm_modules)) {
$perm_modules = user_permission_get_modules();
}
$code = array();
$code[] = ' $permissions = array();';
$code[] = '';
$permissions = _user_configuration_get_permissions();
foreach ($data as $perm_name) {
$permission = array();
$permission['name'] = $perm_name;
if (isset($permissions[$perm_name])) {
sort($permissions[$perm_name]);
$permission['roles'] = $permissions[$perm_name];
$permission['module'] = $perm_modules[$perm_name];
}
else {
$permission['roles'] = array();
}
$perm_identifier = configuration_var_export($perm_name);
$perm_export = configuration_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,
);
}