You are here

public static function RotatingBanner::create in Rotating Banner 7.2

Same name and namespace in other branches
  1. 7 rotating_banner.classes.inc \RotatingBanner::create()
2 calls to RotatingBanner::create()
rotating_banner_add_form_submit in ./rotating_banner.admin.inc
rotating_banner_create in ./rotating_banner.module
Creates a rotating banner record in {rotating_banners}, returns the id.

File

./rotating_banner.classes.inc, line 150

Class

RotatingBanner

Code

public static function create($title, $machine_name = NULL, $settings = NULL) {
  $defaults = RotatingBanner::getDefaultSettings();
  if ($settings) {
    $settings = array_merge($defaults, $settings);
  }
  else {
    $settings = $defaults;
  }
  $rb = new RotatingBanner();
  $rb->title = $title;
  $rb->machine_name = $machine_name ? $machine_name : uniqid('rb_');
  $rb->settings = $settings;
  $rb
    ->save();
  return $rb;
}