You are here

function theme_domain_roles_form in Domain Access 7.3

Same name and namespace in other branches
  1. 6.2 domain.admin.inc \theme_domain_roles_form()
  2. 7.2 domain.admin.inc \theme_domain_roles_form()

FormsAPI theming.

File

./domain.admin.inc, line 1149
Administration functions for the domain module.

Code

function theme_domain_roles_form($variables) {
  $form = $variables['form'];
  $output = '';
  $header = array(
    t('Domains'),
  );
  $rows = array();
  $roles = user_roles();
  $roles[0] = t('new user');
  ksort($roles);
  $domains = domain_domains();
  foreach ($roles as $rid => $role) {
    $header[] = $role;
  }
  foreach ($form['#domain_roles'] as $machine_name => $title) {
    $row = array();
    $row[] = isset($domains[$machine_name]) ? filter_xss_admin($domains[$machine_name]['sitename']) : $title;
    foreach ($roles as $rid => $role) {
      $form['domain_roles'][$rid][$machine_name]['#title'] = '';
      $row[] = drupal_render($form['domain_roles'][$rid][$machine_name]);
    }
    $rows[] = $row;
  }
  $output .= drupal_render($form['domain_add_roles']);
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  return $output;
}