You are here

function theme_notifications_table_form in Notifications 6.4

Same name and namespace in other branches
  1. 6 notifications.admin.inc \theme_notifications_table_form()
  2. 6.2 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_subscription_list_form in ./notifications.pages.inc
List form for subscriptions of the same type for a user

File

./notifications.pages.inc, line 833
User pages for Notifications

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;
}