You are here

function notifications_subscription_form in Notifications 6.3

Same name and namespace in other branches
  1. 6.4 notifications.module \notifications_subscription_form()
  2. 6 notifications.pages.inc \notifications_subscription_form()
  3. 6.2 notifications.pages.inc \notifications_subscription_form()
  4. 7 notifications.module \notifications_subscription_form()

Edit subscription

1 string reference to 'notifications_subscription_form'
notifications_menu in ./notifications.module
Implementation of hook_menu().

File

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

Code

function notifications_subscription_form($form_state, $subscription) {

  // The subscription description will be added here
  $form['info'] = notifications_subscription_info_field($subscription);

  // Subscription values
  $form['subscription'] = array(
    '#type' => 'value',
    '#value' => $subscription,
  );
  $form['send_interval'] = array(
    '#type' => 'select',
    '#title' => t('Send interval'),
    '#options' => _notifications_send_intervals(),
    '#default_value' => $subscription->send_interval,
  );
  $send_methods = _notifications_send_methods();
  $form['send_method'] = array(
    '#type' => 'select',
    '#title' => t('Send method'),
    '#options' => $send_methods,
    '#default_value' => $subscription->send_method,
  );

  // Status, show blocked only to administrators
  $status = _notifications_subscription_status();
  if (!user_access('administer notifications') && !user_access('manage all subscriptions')) {
    unset($status[NOTIFICATIONS_SUBSCRIPTION_BLOCKED]);
  }
  $form['status'] = array(
    '#type' => 'radios',
    '#title' => t('Status'),
    '#options' => $status,
    '#default_value' => $subscription->status,
    '#description' => t('You can temporarily disable this subscription for not getting notifications.'),
  );
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
  );
  return $form;
}