You are here

function theme_og_ui_user_admin_new_role in Organic groups 7

Theme the new role form.

File

og_ui/og_ui.admin.inc, line 459
Admin settings for Organic groups module.

Code

function theme_og_ui_user_admin_new_role($variables) {
  $form = $variables['form'];
  $header = array(
    t('Name'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );

  // The group entity.
  if ($gid = $form['gid']['#value']) {
    $group = og_get_group('group', $gid);
  }
  $default_access = $gid && og_is_group_default_access($gid);
  foreach (og_roles($gid) as $rid => $name) {
    $text = !$default_access ? t('edit permissions') : t('view permissions');
    $path = $gid ? 'group/' . $group->entity_type . '/' . $group->etid . '/admin/people' : 'admin/config/group';
    $permissions = l($text, $path . '/permissions/' . $rid);
    if (!$default_access && !in_array($name, array(
      OG_ANONYMOUS_ROLE,
      OG_AUTHENTICATED_ROLE,
    ))) {
      $rows[] = array(
        $name,
        l(t('edit role'), $path . '/roles/edit/' . $rid),
        $permissions,
      );
    }
    else {
      $rows[] = array(
        $name,
        t('locked'),
        $permissions,
      );
    }
  }
  $rows[] = array(
    array(
      'data' => drupal_render($form['name']) . drupal_render($form['add']),
      'colspan' => 4,
      'class' => 'edit-name',
    ),
  );
  $output = drupal_render_children($form);
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  return $output;
}