You are here

function oa_notifications_build_list_form in Open Atrium Notifications 7.2

1 call to oa_notifications_build_list_form()
oa_notifications_form_fields in ./oa_notifications.module
Define the fields that are used for configuring notifications.

File

./oa_notifications.module, line 649

Code

function oa_notifications_build_list_form($node, $override = FALSE, $editmode = FALSE, $notifications = NULL) {
  $nid = !empty($node->nid) ? $node->nid : 0;
  $element = array(
    '#type' => 'markup',
    '#tree' => TRUE,
    '#prefix' => '<div id="notify-list">',
    '#suffix' => '</div>',
  );
  $allow_edit = $editmode || _oa_notifications_allow_edit($node);
  $element['combined'] = array(
    '#type' => 'textfield',
    '#title' => t('Add groups, teams, or members to notifications'),
    '#multiple' => TRUE,
    '#default_value' => '',
    '#disabled' => empty($override),
    '#access' => $allow_edit,
    '#autocomplete_path' => 'oa_notifications/autocomplete/' . $nid,
    '#ajax' => array(
      'callback' => 'oa_notifications_ajax_callback',
      'wrapper' => 'notify-list',
    ),
    '#limit_validation_errors' => array(),
  );
  $element['data'] = oa_notifications_render_view($node, $editmode, $notifications);
  $element['show_details'] = isset($node->nid) ? oa_notifications_show_details_button() : array();
  $element['notification_remove'] = array(
    '#type' => 'hidden',
    '#value' => '',
    '#attributes' => array(
      'class' => array(
        'oa-notifications-remove',
      ),
    ),
  );
  $element['notification_add'] = array(
    '#type' => 'hidden',
    '#value' => '',
    '#attributes' => array(
      'class' => array(
        'oa-notifications-add',
      ),
    ),
  );
  return $element;
}