function registration_convert_form_settings in Entity Registration 7
Same name and namespace in other branches
- 8.2 includes/registration.forms.inc \registration_convert_form_settings()
- 8 includes/registration.forms.inc \registration_convert_form_settings()
- 7.2 includes/registration.forms.inc \registration_convert_form_settings()
Helper to convert registration entity settings form values into a fields.
Parameters
$values:
Return value
array
2 calls to registration_convert_form_settings()
- registration_entity_settings_form_submit in includes/
registration.forms.inc - Submit handler for registration_entity_settings_form().
- registration_entity_set_default_settings in ./
registration.module - Sets the the registration entity settings to the deafults.
File
- includes/
registration.forms.inc, line 806 - Form definitions and callbacks for Registration.
Code
function registration_convert_form_settings($values) {
$fields = array(
'status' => $values['status'],
'capacity' => $values['capacity'],
'send_reminder' => isset($values['reminder']['send_reminder']) ? $values['reminder']['send_reminder'] : 0,
'reminder_date' => NULL,
'reminder_template' => isset($values['reminder']['reminder_settings']['reminder_template']) ? $values['reminder']['reminder_settings']['reminder_template'] : NULL,
'settings' => serialize($values['settings']),
'open' => NULL,
'close' => NULL,
);
// Reminder: Reminder Date:
if (!empty($values['reminder']['reminder_settings']['reminder_date'])) {
$fields['reminder_date'] = date('Y-m-d H:i:s', strtotime($values['reminder']['reminder_settings']['reminder_date']));
}
// Scheduling: open date:
if (!empty($values['scheduling']['open'])) {
$fields['open'] = date('Y-m-d H:i:s', strtotime($values['scheduling']['open']));
}
// Scheduling: close date:
if (!empty($values['scheduling']['close'])) {
$fields['close'] = date('Y-m-d H:i:s', strtotime($values['scheduling']['close']));
}
return $fields;
}