You are here

function registration_get_default_state in Entity Registration 7.2

Same name and namespace in other branches
  1. 8.2 registration.module \registration_get_default_state()
  2. 8 registration.module \registration_get_default_state()
  3. 7 registration.module \registration_get_default_state()

Return default state

Return value

array

3 calls to registration_get_default_state()
Registration::save in lib/registration.entity.inc
Save registration.
registration_checkin_state_form in modules/registration_checkin/registration_checkin.module
Form builder for the checkin state AJAX form.
registration_form in includes/registration.forms.inc
Form callback: create or edit a registration.

File

./registration.module, line 1757

Code

function registration_get_default_state($type = NULL) {

  // If a type of registration is specified, look for its default registration
  // state before using the global default.
  $states_query = array(
    'default_state' => 1,
  );
  if (isset($type)) {
    $reg_type = registration_get_types($type);
    $states_query = isset($reg_type->default_state) ? array(
      'name' => $reg_type->default_state,
    ) : $states_query;
  }
  $states = registration_states($states_query);
  return !empty($states) ? reset($states) : NULL;
}