You are here

function theme_mail_edit_table in Mail Editor 7

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

The theme function for the mail_edit table.

Parameters

array $variables:

Return value

string

File

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

Code

function theme_mail_edit_table($variables) {
  $form = $variables['form'];
  $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', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'mail-edit-table',
    ),
  ));
  if ($form['pager']) {
    $output .= drupal_render($form['pager']);
  }
  return $output;
}