function dynamic_banner_set_banner in Dynamic Banner 7.2
Same name and namespace in other branches
- 7 includes/callbacks.inc \dynamic_banner_set_banner()
- 8.x dynamic_banner.module \dynamic_banner_set_banner()
Set a banner for a given path, preventing duplicates. Note if dbid comes in null then we are creating a banner
1 call to dynamic_banner_set_banner()
- dynamic_banner_admin_form_submit in ./
dynamic_banner.module - Save a new Banner to the database
File
- ./
dynamic_banner.module, line 828 - Distributed under GNU GPL version 3
Code
function dynamic_banner_set_banner($path, $imgurl, $imgfid, $text, $link, $mode = BANNER_DEFAULT_BANNER_MODE, $time_on, $time_off, $dbid = NULL) {
// First we check if we are dealing with an existing alias and delete or modify it based on dbid.
// We dont need to do a complicated check here because the code already made it for us
if ($dbid) {
// Update the existing banner.
db_update('dynamic_banner')
->fields(array(
'path' => drupal_strtolower($path),
'imgurl' => $imgurl,
'imgfid' => $imgfid,
'text' => $text,
'link' => $link,
'mode' => $mode,
'start_time' => $time_on,
'end_time' => $time_off,
))
->condition('dbid', $dbid)
->execute();
}
else {
db_insert('dynamic_banner')
->fields(array(
'path' => drupal_strtolower($path),
'imgurl' => $imgurl,
'imgfid' => $imgfid,
'text' => $text,
'link' => $link,
'mode' => $mode,
'start_time' => $time_on,
'end_time' => $time_off,
))
->execute();
}
}