You are here

function rate_ui_widget_save_widget in Rate 7.2

Save widget settings from storage array into database.

Parameters

int $wid:

array $storage:

1 call to rate_ui_widget_save_widget()
rate_ui_widget_form_submit in ui/rate_ui.form.inc
Implements hook_form_submit().

File

ui/rate_ui.form.inc, line 707
This file contains the differtent Rate UI forms.

Code

function rate_ui_widget_save_widget($wid, $storage) {
  $widget = new stdClass();
  $widget->type = $storage['type'];
  $widget->name = $storage['name'];
  $widget->mode = $storage['mode'];
  $widget->sprites = (int) (!empty($storage['sprites']));
  $widget->highlight_voted = $storage['highlight_voted'];
  $widget->highlight_mouseover = $storage['highlight_mouseover'];
  $widget->desc_norating = $storage['desc_norating'];
  $widget->desc_notvoted = $storage['desc_notvoted'];
  $widget->desc_voted = $storage['desc_voted'];
  $widget->desc_justvoted = $storage['desc_justvoted'];
  $widget->desc_mouseover = $storage['desc_mouseover'];
  if ($storage['images'] && $storage['imagesource'] != 'spritegenerator') {
    $widget->css_file = rate_ui_write_css($storage);
  }
  $widget->js_file = NULL;
  if ($wid) {
    $widget->wid = $wid;
    drupal_write_record('rate_widget', $widget, array(
      'wid',
    ));
  }
  else {
    drupal_write_record('rate_widget', $widget);
  }
  return $widget->wid;
}