You are here

function user_role_features_export_render in Features 6

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

Implementation of hook_features_export_render().

File

includes/features.user.inc, line 180

Code

function user_role_features_export_render($module, $data) {
  $code = array();
  $code[] = '  $roles = array();';
  $code[] = '';
  $roles = _features_get_roles();
  foreach ($data as $role) {
    if (isset($roles[$role])) {
      $object = array(
        'name' => $role,
      );
      $role_identifier = features_var_export($role);
      $role_export = features_var_export($object, '  ');
      $code[] = "  // Exported role: {$role}";
      $code[] = "  \$roles[{$role_identifier}] = {$role_export};";
      $code[] = "";
    }
  }
  $code[] = '  return $roles;';
  $code = implode("\n", $code);
  return array(
    'user_default_roles' => $code,
  );
}