You are here

function _subscriptions_mail_form_mail_edit_template_form_alter in Subscriptions 7

Same name and namespace in other branches
  1. 2.0.x subscriptions_mail/subscriptions_mail.mail_edit.inc \_subscriptions_mail_form_mail_edit_template_form_alter()

Implements hook_form_alter().

Adds the preview functionality to mail_edit's edit page.

_state

Parameters

$form:

1 call to _subscriptions_mail_form_mail_edit_template_form_alter()
subscriptions_mail_form_mail_edit_template_form_alter in ./subscriptions_mail.module
Implements hook_form_alter().

File

./subscriptions_mail.mail_edit.inc, line 176
Subscriptions_mail module integration with Mail Editor module.

Code

function _subscriptions_mail_form_mail_edit_template_form_alter(&$form, &$form_state) {
  $mailkey = $form['id']['#value'];
  $type_ = 'subscriptions_mail_node-type-';
  if (strpos($mailkey, $type_) === 0) {
    $form['content_type'] = array(
      '#type' => 'hidden',
      '#value' => substr($mailkey, strlen($type_)),
    );
  }
  if (isset($form_state['template_preview'])) {
    $form['template_preview'] = array(
      '#type' => 'fieldset',
      '#title' => t('Template preview'),
      '#collapsible' => TRUE,
      '#weight' => -5,
    ) + $form_state['template_preview'];
  }
  $form['preview'] = array(
    '#type' => 'submit',
    '#value' => t('Preview template'),
    '#submit' => array(
      'subscriptions_mail_preview',
    ),
    '#weight' => 7,
  );
}