function botcha_recipebook_form_submit in BOTCHA Spam Prevention 7.2
Same name and namespace in other branches
- 6.2 botcha.admin.inc \botcha_recipebook_form_submit()
Submit handler for botcha_recipebook_form.
Parameters
$form: Form API form array.
$form_state: Form API form state array.
File
- ./
botcha.admin.inc, line 197 - Implementation of botcha administration forms.
Code
function botcha_recipebook_form_submit($form, &$form_state) {
$values = $form_state['values'];
$recipebook = Botcha::getRecipebook($values['id'])
->setTitle($values['title'])
->setDescription($values['description']);
/*
foreach (array_filter($values['recipes']) as $recipe_id) {
$recipebook->setRecipe($recipe_id);
}
*
*/
foreach ($values['recipes'] as $recipe_id => $value) {
if ($value) {
$recipebook
->setRecipe($recipe_id);
}
else {
$recipebook
->unsetRecipe($recipe_id);
}
}
$recipebook
->save();
$form_state['redirect'] = Botcha::BOTCHA_ADMIN_PATH . '/recipebook';
drupal_set_message(t('Settings for recipe book "%recipebook" are successfully saved.', array(
'%recipebook' => $recipebook->id,
)), 'status');
}