You are here

function registration_waitlist_registration_entity_settings in Entity Registration 8.2

Same name and namespace in other branches
  1. 8 modules/registration_waitlist/registration_waitlist.module \registration_waitlist_registration_entity_settings()
  2. 7.2 modules/registration_waitlist/registration_waitlist.module \registration_waitlist_registration_entity_settings()
  3. 7 modules/registration_waitlist/registration_waitlist.module \registration_waitlist_registration_entity_settings()

Implements hook_registration_entity_settings().

File

modules/registration_waitlist/registration_waitlist.module, line 13
Entity Registration waitlist functionality

Code

function registration_waitlist_registration_entity_settings($settings) {

  // Add a settings element to enable adding registrations to the waitlist.
  return array(
    'registration_waitlist_enable' => array(
      '#type' => 'checkbox',
      '#title' => t('Enable wait list'),
      '#description' => t('When wait list is enabled, registrations made after capacity has been reached will be set to the wait list state.'),
      '#default_value' => isset($settings['settings']['registration_waitlist_enable']) ? $settings['settings']['registration_waitlist_enable'] : 0,
    ),
    'registration_waitlist_capacity' => array(
      '#type' => 'textfield',
      '#title' => t('Wait list capacity'),
      '#size' => 5,
      '#maxsize' => 10,
      '#required' => TRUE,
      '#description' => t('The maximum number of registrants on the wait list. Leave at 0 for no limit.'),
      '#default_value' => isset($settings['settings']['registration_waitlist_capacity']) ? $settings['settings']['registration_waitlist_capacity'] : 0,
      '#states' => array(
        'visible' => array(
          ':input[name="settings[registration_waitlist_enable]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    ),
    'registration_waitlist_message_enable' => array(
      '#type' => 'checkbox',
      '#title' => t('Enable wait list message'),
      '#description' => t('Enable to allow display of a message above the registration form when capacity has been reached.'),
      '#default_value' => isset($settings['settings']['registration_waitlist_message_enable']) ? $settings['settings']['registration_waitlist_message_enable'] : 1,
      '#states' => array(
        'visible' => array(
          ':input[name="settings[registration_waitlist_enable]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    ),
    'registration_waitlist_message' => array(
      '#type' => 'textarea',
      '#title' => t('Wait list message'),
      '#description' => t('Enter a message to display above the registration form to notify users that they will be placed on a waitlist.  Message only appears if capacity is reached.'),
      '#default_value' => isset($settings['settings']['registration_waitlist_message']) ? $settings['settings']['registration_waitlist_message'] : 'Please note: completing this registration form will place you on a waitlist as there are currently no places left.',
      '#states' => array(
        'visible' => array(
          ':input[name="settings[registration_waitlist_message_enable]"]' => array(
            'checked' => TRUE,
          ),
          ':input[name="settings[registration_waitlist_enable]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    ),
  );
}