You are here

function notifications_custom_form_alter in Notifications 6.4

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

Implementation of hook_form_alter().

File

notifications_custom/notifications_custom.module, line 193
Custom notifications module

Code

function notifications_custom_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'notifications_user_overview') {
    $conditions = user_access('administer users') ? array() : array(
      'visibility' => 1,
    );
    if ($custom = notifications_custom_build_list($conditions, $form['account']['#value'])) {
      $form['custom'] = array(
        '#type' => 'item',
        '#title' => t('edit subscriptions'),
        '#weight' => 25,
      );
      $form['custom']['notifications_custom']['#tree'] = TRUE;
      foreach ($custom as $subscription) {
        $form['custom']['notifications_custom'][$subscription->type] = $subscription
          ->form_element();
      }
      $form['custom']['button'] = array(
        '#type' => 'submit',
        '#value' => t('Update'),
      );
      $form['#submit'][] = 'notifications_custom_user_overview_submit';
    }
  }
}