You are here

function theme_userprotect_admin_role_table in User protect 7

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

Themes the role protections table.

Parameters

array $variables: Contains the form for the table.

Return value

string An HTML string representing the table.

File

./userprotect.admin.inc, line 416
Administration functions for userprotect module.

Code

function theme_userprotect_admin_role_table($variables) {
  $form = $variables['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', array(
    'header' => $form['#header'],
    'rows' => $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_children($form);
  return $output;
}