function context_ui_form_submit in Context 5
Same name and namespace in other branches
- 6.3 context_ui/export_ui/context_export_ui.class.php \context_ui_form_submit()
- 6 context_ui/context_ui.admin.inc \context_ui_form_submit()
- 6 context_ui/export_ui/context_export_ui.class.php \context_ui_form_submit()
- 6.2 context_ui/context_ui.admin.inc \context_ui_form_submit()
- 7.3 context_ui/export_ui/context_export_ui.class.php \context_ui_form_submit()
Submit handler for main context_ui form.
File
- context_ui/
context_ui_admin.inc, line 778
Code
function context_ui_form_submit($form_id, $form_values) {
switch (t($form_values['op'])) {
// Send user to delete confirmation page
case 'Delete':
return 'admin/build/context/delete/' . $form_values['cid'];
// Process form values and save and/or update the context in the db
case 'Save':
$context = context_ui_form_process($form_values);
if (!$context->cid) {
$result = context_ui_context('insert', $context);
if ($result) {
drupal_set_message(t('The context %title was saved successfully.', array(
'%title' => $context->value,
)));
break;
}
}
else {
if (context_ui_context('load', $context->cid)) {
$result = context_ui_context('update', $context);
if ($result) {
drupal_set_message(t('The context %title was saved successfully.', array(
'%title' => $context->value,
)));
break;
}
}
}
drupal_set_message(t('An error occurred while attempting to save your context information.'), 'error');
break;
}
// rebuild cache
context_ui_rebuild();
return 'admin/build/context';
}