You are here

function theme_mail_edit_table in Mail Editor 6

Same name and namespace in other branches
  1. 7 mail_edit.admin.inc \theme_mail_edit_table()

The theme function for the mail edit table.

Parameters

$form:

Return value

string

File

./mail_edit.admin.inc, line 276
Administrative interface for the Mail Editor module.

Code

function theme_mail_edit_table($form) {
  $rows = array();
  $header = $form['header']['#value'];
  $languages = $form['languages']['#value'];
  foreach (element_children($form['templates']) as $key) {

    // Build the table row.
    $row = array();
    $row['data'][] = array(
      'data' => drupal_render($form['templates'][$key]['module']),
    );
    $row['data'][] = array(
      'data' => drupal_render($form['templates'][$key]['mailkey']) . '<div class="description">' . drupal_render($form['templates'][$key]['description']) . '</div>',
    );
    foreach ($languages as $lang_code => $lang_name) {
      $row['data'][] = array(
        'data' => drupal_render($form['templates'][$key][$lang_code]),
        'class' => 'mail-edit-table-' . $lang_code,
      );
    }
    $row['data'][] = array(
      'data' => drupal_render($form['templates'][$key]['operations']),
    );
    $rows[] = $row;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No templates available for override.'),
        'colspan' => count($header),
      ),
    );
  }
  $output = theme('table', $header, $rows, array(
    'id' => 'mail-edit-table',
  ));
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  return $output;
}