function registration_get_default_state in Entity Registration 8.2
Same name and namespace in other branches
- 8 registration.module \registration_get_default_state()
- 7.2 registration.module \registration_get_default_state()
- 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::save in src/
Registration.php - Save registration.
- registration_form in includes/
registration.forms.inc - Form callback: create or edit a registration.
File
- ./
registration.module, line 1725
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;
}