You are here

function user_role_features_export_render in Features 7.2

Same name and namespace in other branches
  1. 6 includes/features.user.inc \user_role_features_export_render()
  2. 7 includes/features.user.inc \user_role_features_export_render()

Implements hook_features_export_render().

File

includes/features.user.inc, line 207
Features integration for 'user' module.

Code

function user_role_features_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 = features_var_export($name);
      $role_export = features_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,
  );
}