function mail_edit_form in Mail Editor 5
1 string reference to 'mail_edit_form'
- mail_edit_overview in ./
mail_edit.module - Menu callback; administrative mail editing overview.
File
- ./
mail_edit.module, line 125
Code
function mail_edit_form($mailkey) {
drupal_set_title(t('Settings for %mailkey', array(
'%mailkey' => $mailkey,
)));
if ($defaults = db_fetch_array(db_query("SELECT * FROM {mail_edit} WHERE mailkey = '%s'", $mailkey))) {
$insert = FALSE;
}
else {
$insert = TRUE;
$defaults = array(
'description' => '',
'subject' => '',
'body' => '',
);
}
$form['insert'] = array(
'#type' => 'value',
'#value' => $insert,
);
$form['mailkey'] = array(
'#type' => 'value',
'#value' => $mailkey,
);
$form['_submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => -40,
);
$form['description'] = array(
'#type' => 'textfield',
'#title' => t('Message description'),
'#default_value' => $defaults['description'],
'#description' => t("The description of this message (for admins only; users don't see this, except possibly in <a href='/subscriptions/pmsg'>/subscriptions/pmsg</a>, if the Subscriptions module is active.)"),
'#weight' => 0,
);
$form['subject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#default_value' => $defaults['subject'],
'#description' => t('The subject of the mail or private message.'),
'#weight' => 10,
);
$form['body'] = array(
'#type' => 'textarea',
'#title' => t('Body'),
'#default_value' => $defaults['body'],
'#description' => t('The body of the mail or private message.'),
'#weight' => 20,
);
$form['help'] = array(
'#theme' => 'mail_edit_variables',
'#variables' => array(
'!recipient_name' => t('Name of the recipient.'),
'!recipient_page' => 'The user page of the recipient.',
'!sender_name' => t('Name of the sender.'),
'!sender_page' => t('The user page of the sender.'),
'!sender_contact_page' => t('The contact page of the sender.'),
),
'#weight' => 30,
);
if (substr($mailkey, 0, 7) == 'contact') {
$form['help']['#variables'] += array(
'!message' => t('The contact message itself.'),
'!subject' => t('The subject of the contact message.'),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => 40,
);
return $form;
}