You are here

function theme_smtp_selection_criteria in SMTP Authentication Support 7.2

Themes a selection criteria as a logical expression (as shown in the administration page's table). Render array structure: #criteria => The selection criteria (associative array) to be displayed.

Parameters

vars: Variables passed to the theme function.

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

File

./smtp.theme.inc, line 42

Code

function theme_smtp_selection_criteria(&$vars) {
  $element =& $vars['element'];
  $criteria =& $element['#criteria'];
  $output = '';

  // Module
  if (!empty($criteria['message_module'])) {
    $expression = t('Module') . '=' . $criteria['message_module'];
    $output = '<em>' . check_plain($expression) . '</em>';
  }

  // Key
  if (!empty($criteria['message_key'])) {
    $expression2 = t('Key', array(), array(
      'context' => 'identifier',
    )) . '=' . $criteria['message_key'];
    if ($output) {
      $t_args = array(
        '!expression1' => $output,
        '%expression2' => $expression2,
      );
      $output = t('!expression1 AND %expression2', $t_args);
    }
    else {
      $output = '<em>' . check_plain($expression2) . '</em>';
    }
  }

  // Language
  if (!empty($criteria['message_language'])) {
    $languages = language_list();
    $language_code = $criteria['message_language'];
    $expression2 = t('Language') . '=' . $languages[$language_code]->name;
    if ($output) {
      $t_args = array(
        '!expression1' => $output,
        '%expression2' => $expression2,
      );
      $output = t('!expression1 AND %expression2', $t_args);
    }
    else {
      $output = '<em>' . check_plain($expression2) . '</em>';
    }
  }
  if (empty($output)) {
    $output = '*';
  }
  return $output;
}