You are here

function theme_messaging_admin_settings_table in Messaging 6.4

Same name and namespace in other branches
  1. 7 messaging.admin.inc \theme_messaging_admin_settings_table()

Theme settings as table

2 theme calls to theme_messaging_admin_settings_table()
messaging_admin_method_filters in ./messaging.admin.inc
Settings for filter and formatting for each sending method
messaging_admin_method_settings in ./messaging.admin.inc
Default sending methods settings

File

./messaging.admin.inc, line 286
Messaging Framework - Admin UI

Code

function theme_messaging_admin_settings_table($elements) {
  if (isset($elements['#table_header'])) {
    $header = $elements['#table_header'];
    $extract_headers = FALSE;
  }
  else {
    $header = array();
    $extract_headers = TRUE;
  }
  $rows = array();
  foreach (element_children($elements) as $index) {
    $row = array();
    foreach (element_children($elements[$index]) as $key) {
      if ($elements[$index][$key]['#type'] == 'value') {
        continue;
      }
      if (isset($elements[$index][$key]['#title'])) {
        if ($extract_headers) {

          // Extract the titles from elements
          $header[] = $elements[$index][$key]['#title'];
        }
        unset($elements[$index][$key]['#title']);
      }
      $row[] = drupal_render($elements[$index][$key]);
    }
    $rows[] = $row;
    $extract_headers = FALSE;
  }
  if ($rows) {
    $output = theme('table', $header, $rows);
  }
  else {
    $output = t('No data available');
  }
  $output .= drupal_render($elements);
  return $output;
}