You are here

function theme_notifications_table_form in Notifications 6.2

Same name and namespace in other branches
  1. 6.4 notifications.pages.inc \theme_notifications_table_form()
  2. 6 notifications.admin.inc \theme_notifications_table_form()
  3. 6.3 notifications.admin.inc \theme_notifications_table_form()
  4. 7 notifications.pages.inc \theme_notifications_table_form()

Generic table formatting for forms

1 theme call to theme_notifications_table_form()
notifications_admin_queue_operations in ./notifications.admin.inc
Form for queue operations

File

./notifications.admin.inc, line 506

Code

function theme_notifications_table_form($form) {
  $output = '';

  // Get table information from special form properties
  $index = !empty($form['#table_index']) ? $form['#table_index'] : $form['#table_fields'][0];
  $header = !empty($form['#table_header']) ? $form['#table_header'] : array();
  foreach (element_children($form[$index]) as $key) {
    $row = array();
    foreach ($form['#table_fields'] as $field) {
      $row[] = drupal_render($form[$field][$key]);
    }
    $rows[] = $row;
  }
  if ($rows) {
    $output .= theme('table', $header, $rows);
  }
  else {
    $output .= '<p>' . t('No elements') . '</p>';
  }
  $output .= drupal_render($form);
  return $output;
}