function spaces_preset_form_submit in Spaces 5.2
Same name and namespace in other branches
- 6 spaces_admin.inc \spaces_preset_form_submit()
- 6.2 spaces_admin.inc \spaces_preset_form_submit()
Submit handler for spaces preset form.
File
- ./
spaces_admin.inc, line 294
Code
function spaces_preset_form_submit($form_id, $form_values) {
// Retrieve the space object from the form
$space = $form_values['space'];
$preset = array(
'name' => '',
'description' => '',
'features' => array(),
'settings' => array(),
'locked' => array(),
);
// Set name / description
$preset['name'] = $form_values['preset']['name'];
$preset['description'] = $form_values['preset']['description'];
// Setting features & locks is easy
$preset['features'] = $form_values['features'];
$preset['locked'] = $form_values['locked'];
// Set setting values
$settings = spaces_settings();
foreach ($form_values['settings'] as $setting => $value) {
$preset['settings'][$setting] = $settings[$setting]
->submit($space, $value);
}
// Allow space_type to have its own preset values
$preset[$space->type] = $space
->submit($form_values);
spaces_preset_save($space->type, $form_values['preset']['id'], $preset);
return 'admin/build/spaces';
}