You are here

function theme_smtp_table in SMTP Authentication Support 7.2

Themes a table that allows rows and columns to be render arrays. This is used to create a drag and drop table on the administration page. The children of the root element are considered table rows and their children are the table columns.

Parameters

vars: Variables passed to the theme function.

1 theme call to theme_smtp_table()
smtp_admin_settings in ./smtp.admin.inc
Administrative settings.

File

./smtp.theme.inc, line 11

Code

function theme_smtp_table(&$vars) {
  $table_element =& $vars['element'];
  $rows = array();
  foreach (element_children($table_element, TRUE) as $row_name) {
    $row_element =& $table_element[$row_name];
    $row = !empty($row_element['#attributes']) ? $row_element['#attributes'] : array();
    $row_data = array();
    foreach (element_children($row_element, TRUE) as $col_name) {
      $row_data[] = render($row_element[$col_name]);
    }
    $row['data'] = $row_data;
    $rows[] = $row;
    unset($table_element[$row_name]);
  }
  $table_element['#rows'] = $rows;
  $table_element['#theme'] = 'table';
  return render($table_element);
}