You are here

public function Notifications_Subscription_List::get_form in Notifications 7

Get options form

File

./notifications.list.inc, line 220
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription_List
List of subscriptions or subscription types

Code

public function get_form($type, $form, &$form_state) {
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $type,
  );
  $form['subscription_list'] = array(
    '#type' => 'value',
    '#value' => $this,
  );
  switch ($type) {
    case 'checkboxes':

      // List of subscribe/unsubscribe checkboxes
      $form['operation'] = array(
        '#type' => 'value',
        '#value' => 'update',
      );
      $form['subscriptions'] = $this
        ->element_checkboxes();
      $form['save'] = array(
        '#type' => 'submit',
        '#value' => t('Update'),
      );
      $destination = $_GET['q'];
      break;
    case 'unsubscribe':
    case 'delete':

      // Unsubscribe confirm form
      $form['operation'] = array(
        '#type' => 'value',
        '#value' => 'unsubscribe',
      );
      $form['subscriptions'] = $this
        ->element_items();
      $form = confirm_form($form, t('Are you sure you want to delete these subscriptions?'), variable_get('notifications_frontpage', variable_get('site_frontpage', 'node')), t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
      break;
  }
  return $form;
}