You are here

function notifications_form_subscribe_confirm in Notifications 6

Same name and namespace in other branches
  1. 6.2 notifications.pages.inc \notifications_form_subscribe_confirm()
  2. 6.3 notifications.pages.inc \notifications_form_subscribe_confirm()

Form for subscription confirmation

1 string reference to 'notifications_form_subscribe_confirm'
notifications_page_subscribe in ./notifications.pages.inc
Menu callback add subscription

File

./notifications.pages.inc, line 202
User pages for Notifications

Code

function notifications_form_subscribe_confirm($form_state, $subscription, $account) {

  // Pass on simple values
  foreach (array(
    'sid',
    'uid',
    'type',
    'fields',
    'event_type',
  ) as $field) {
    $form[$field] = array(
      '#type' => 'value',
      '#value' => $subscription->{$field},
    );
  }

  // The names will be added here
  notifications_module_invoke('names', $subscription);
  $form['info'] = array(
    '#type' => 'item',
    '#title' => t('!type subscription to', array(
      '!type' => $subscription->type_name,
    )),
    '#value' => theme('item_list', $subscription->names),
  );

  // Additional parameters
  $form['send_interval'] = array(
    '#type' => 'select',
    '#title' => t('Send interval'),
    '#options' => _notifications_send_intervals(),
    '#default_value' => $subscription->send_interval,
  );
  $send_methods = _notifications_send_methods($account);
  $form['send_method'] = array(
    '#type' => 'select',
    '#title' => t('Send method'),
    '#options' => $send_methods,
    '#default_value' => $subscription->send_method,
    '#disabled' => count($send_methods) < 2,
  );
  $form['confirm'] = array(
    '#type' => 'submit',
    '#value' => t('Subscribe'),
  );
  $form['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
  );
  return $form;
}