You are here

function _mail_edit_list_row in Mail Editor 7

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

Build one row of the mail edit table.

Parameters

$template: The mail template for this row.

$languages array: The languages to include.

$display_language_names bool: Whether to display the language names

Return value

array

1 call to _mail_edit_list_row()
mail_edit_list_filtered_form in ./mail_edit.admin.inc
Create $form array with filtered list.

File

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

Code

function _mail_edit_list_row($template, array $languages, $display_language_names) {
  $module_list = _mail_edit_module_list(TRUE);
  $form['module'] = array(
    '#markup' => isset($module_list[$template->module]) ? $module_list[$template->module] : check_plain($template->module),
  );
  $form['id'] = array(
    '#markup' => check_plain($template->id),
  );
  $form['mailkey'] = array(
    '#markup' => check_plain($template->mailkey),
  );
  $form['description'] = array(
    '#markup' => filter_xss_admin($template->description),
  );
  $count = 0;
  foreach ($languages as $lang_code => $lang_name) {
    $variable = array(
      '@language' => $lang_code,
    );
    if (isset($template->languages[$lang_code])) {
      $link_text = t($display_language_names ? 'Edit @language' : 'Edit', $variable);
      $count++;
    }
    else {
      $link_text = t($display_language_names ? 'Add @language' : 'Add', $variable);
    }
    $form['operations'] = array(
      '#markup' => l($count > 0 ? t('Purge All') : t('Purge'), 'admin/config/system/mail-edit/purge/' . $template->module . '_' . $template->mailkey),
    );
    $form[$lang_code] = array(
      '#markup' => l($link_text, 'admin/config/system/mail-edit/' . $template->id . '/' . $lang_code),
    );
  }
  return $form;
}