You are here

function og_features_role_features_export_render in Organic groups 7.2

Implements hook_features_export_render().

File

includes/og_features_role.features.inc, line 65
Integration with features for og roles.

Code

function og_features_role_features_export_render($module, $data) {
  $code = array();
  $code[] = '  $roles = array();';
  $code[] = '';
  foreach ($data as $name) {
    list($group_type, $bundle, $rolename) = explode(':', $name);
    $role = array(
      'gid' => 0,
      'group_type' => $group_type,
      'group_bundle' => $bundle,
      'name' => $rolename,
    );
    $role_identifier = features_var_export($name);
    $role_export = features_var_export($role, '  ');
    $code[] = "  // Exported OG Role: {$role_identifier}.";
    $code[] = "  \$roles[{$role_identifier}] = {$role_export};";
    $code[] = "";
  }
  $code[] = '  return $roles;';
  $code = implode("\n", $code);
  return array(
    'og_features_default_roles' => $code,
  );
}