You are here

function theme_userprotect_admin_role_table in User protect 5

Same name and namespace in other branches
  1. 6 userprotect.module \theme_userprotect_admin_role_table()
  2. 7 userprotect.admin.inc \theme_userprotect_admin_role_table()

Themes the role protections table.

Parameters

$form The form for the table.:

Return value

An HTML string representing the table.

File

./userprotect.module, line 808

Code

function theme_userprotect_admin_role_table($form) {
  $rows = array();

  // Build a row for each role
  foreach (element_children($form['userprotect_role_protections']) as $rid) {
    $row = array();
    $row[] = drupal_render($form['userprotect_role_protections'][$rid]['name']);

    // Build the protections for each row.
    foreach ($form['#protections'] as $protection) {
      $row[] = drupal_render($form['userprotect_role_protections'][$rid][$protection]);
    }
    $rows[] = $row;
  }

  // Theme the table.
  $output = t('<h3>Protections by role</h3>');
  $output .= theme('table', $form['#header'], $rows);
  $output .= t('<div class="description">Setting a protection for a role will enable that protection for all users in the role.</div>');
  $output .= drupal_render($form);
  return $output;
}