function user_role_configuration_export_render in Configuration Management 7
Implements hook_configuration_export_render().
2 calls to user_role_configuration_export_render()
- configuration_check_user_role in includes/
configuration.user.inc - User roles are unique in that the name of the config and the name of the role are the same. If you change the name of the role, you are effectively creating a new configuration item. For that reason, we have to check to see what roles are no longer…
- configuration_hash_user_role in includes/
configuration.user.inc
File
- includes/
configuration.user.inc, line 181
Code
function user_role_configuration_export_render($module, $data) {
$code = array();
$code[] = ' $roles = array();';
$code[] = '';
foreach ($data as $name) {
if ($role = user_role_load_by_name($name)) {
unset($role->rid);
$role_identifier = configuration_var_export($name);
$role_export = configuration_var_export($role, ' ');
$code[] = " // Exported role: {$name}";
$code[] = " \$roles[{$role_identifier}] = {$role_export};";
$code[] = "";
}
}
$code[] = ' return $roles;';
$code = implode("\n", $code);
return array(
'user_default_roles' => $code,
);
}