You are here

function smtp_admin_criteria_settings in SMTP Authentication Support 7.2

Administrative settings.

Parameters

form: An associative array containing the structure of the form.

form_state: A keyed array containing the current state of the form.

criteria: The selection criteria being edited.

Return value

An array containing form items to place on the selection criteria edit page.

1 string reference to 'smtp_admin_criteria_settings'
smtp_menu in ./smtp.module
Implements hook_menu().

File

./smtp.admin.inc, line 682
Administrative page code for the smtp module.

Code

function smtp_admin_criteria_settings($form, &$form_state, $criteria = NULL) {
  $form_state['storage']['criteria'] = $criteria;
  $providers = variable_get('smtp_providers', array());
  $provider_options = array();
  foreach ($providers as $machine_name => $provider) {
    $provider_options[$machine_name] = $provider['name'];
  }
  $form['provider'] = array(
    '#type' => 'select',
    '#title' => t('Provider'),
    '#description' => t('Provider to be used when this criteria is satisfied.'),
    '#options' => $provider_options,
    '#required' => TRUE,
    '#default_value' => isset($criteria['provider']) ? $criteria['provider'] : NULL,
  );
  $form['message'] = array(
    '#type' => 'fieldset',
    '#title' => t('Message conditions'),
    '#tree' => TRUE,
  );
  $form['message']['module'] = array(
    '#type' => 'select',
    '#title' => t('Module'),
    '#description' => t('Messages sent by the selected module.'),
    '#options' => array(
      '' => t('Any'),
    ) + module_list(FALSE, FALSE, TRUE),
    '#default_value' => isset($criteria['message_module']) ? $criteria['message_module'] : '',
  );
  $form['message']['key'] = array(
    '#type' => 'textfield',
    '#title' => t('Key', array(), array(
      'context' => 'identifier',
    )),
    '#description' => t('The key provided to <a href="https://api.drupal.org/api/drupal/includes!mail.inc/function/drupal_mail/7.x" target="_blank">drupal_mail()</a>. Leave it blank for any value.'),
    '#default_value' => isset($criteria['message_key']) ? $criteria['message_key'] : '',
  );
  $language_options = array(
    '' => t('Any'),
  );
  foreach (language_list() as $code => $language) {
    $language_options[$code] = $language->name;
  }
  $form['message']['language'] = array(
    '#type' => 'select',
    '#title' => t('Language'),
    '#description' => t('The message\'s language.'),
    '#options' => $language_options,
    '#default_value' => isset($criteria['message_language']) ? $criteria['message_language'] : '',
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}