You are here

function theme_messaging_admin_settings_table in Messaging 7

Same name and namespace in other branches
  1. 6.4 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 302
Messaging Framework - Admin UI

Code

function theme_messaging_admin_settings_table($variables) {
  $elements = $variables['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 (isset($elements[$index][$key]['#type']) && $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', array(
      'header' => $header,
      'rows' => $rows,
    ));
  }
  else {
    $output = t('No data available');
  }
  $output .= drupal_render_children($elements);
  return $output;
}