function dynamic_banner_admin_form_submit in Dynamic Banner 8.x
Same name and namespace in other branches
- 6 includes/callbacks.inc \dynamic_banner_admin_form_submit()
- 7.2 dynamic_banner.module \dynamic_banner_admin_form_submit()
- 7 includes/callbacks.inc \dynamic_banner_admin_form_submit()
Save a new Banner to the database
File
- ./
dynamic_banner.module, line 790 - Distributed under GNU GPL version 3
Code
function dynamic_banner_admin_form_submit($form, &$form_state) {
// Define a sort of struct array for display mode for form translation
// Extra validation check to make sure
if ($form_state['values']['image_type'] == t('Use Existing Image(s)')) {
$imgurl = $form_state['values']['imgurl'];
}
else {
$imgurl = NULL;
}
if ($form_state['values']['image_type'] == t('Upload New Image(s)')) {
$imgfid = $form_state['values']['image']['fid'];
}
else {
$imgfid = NULL;
}
$path = $form_state['values']['path'];
$text = $form_state['values']['text'];
$link = $form_state['values']['link'];
$mode = $form_state['values']['mode'];
//$time_on = $form_state['values']['time_on'];// these are arrays we need a time handler
//$time_off = $form_state['values']['time_off'];
$dbid = $form_state['values']['dbid'];
$time_on = NULL;
$time_off = NULL;
// Save the banner
dynamic_banner_set_banner($path, $imgurl, $imgfid, $text, $link, $mode, $time_on, $time_off, $dbid);
drupal_set_message(t('The banner has been saved.'));
$form_state['redirect'] = 'admin/structure/banners';
}