You are here

function theme_userprotect_protections_bypass in User protect 5

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

Themes the protected users table.

Parameters

$form The form to theme.:

Return value

An HTML string representing the constructed form.

File

./userprotect.module, line 547

Code

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

  // Buikd the row for each user.
  foreach (element_children($form['user']) as $uid) {
    $row = array();
    $row[] = drupal_render($form[$uid]['name']);

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

  // Add the last row with the add textfield.
  $rows[] = array(
    array(
      'data' => drupal_render($form['up_add']),
      'colspan' => strval(count($form['#header']) - 1),
    ),
    array(
      'data' => drupal_render($form['up_add_text']),
      'colspan' => '1',
    ),
  );

  // Theme the table.
  $output = theme('table', $form['#header'], $rows);
  $output .= drupal_render($form);
  return $output;
}