You are here

function notifications_custom_form_alter in Notifications 6

Same name and namespace in other branches
  1. 6.4 notifications_custom/notifications_custom.module \notifications_custom_form_alter()

Implementation of hook_form_alter()

File

notifications_custom/notifications_custom.module, line 171
Custom notifications module

Code

function notifications_custom_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'notifications_user_overview' && ($custom = notifications_custom_list(array(
    'visibility' => 1,
  )))) {
    $form['custom'] = array(
      '#type' => 'item',
      '#title' => t('edit subscriptions'),
      '#weight' => 25,
    );
    $form['custom']['notifications_custom']['#tree'] = TRUE;
    foreach ($custom as $subs) {
      $form['custom']['notifications_custom'][$subs->type] = array(
        '#type' => 'checkbox',
        '#title' => $subs->title,
        '#default_value' => (bool) notifications_custom_get_subscription($subs->type, $form['account']['#value']->uid),
        '#description' => $subs->explanation,
      );
    }
    $form['custom']['button'] = array(
      '#type' => 'submit',
      '#value' => t('Update'),
    );
    $form['#submit'][] = 'notifications_custom_user_overview_submit';
  }
}