function rate_ui_widget_save_layout in Rate 7.2
Save widget layout from storage array into database.
Parameters
int $wid:
array $storage:
1 call to rate_ui_widget_save_layout()
- rate_ui_widget_form_submit in ui/
rate_ui.form.inc - Implements hook_form_submit().
File
- ui/
rate_ui.form.inc, line 821 - This file contains the differtent Rate UI forms.
Code
function rate_ui_widget_save_layout($wid, $storage) {
if ($wid) {
// Delete old configuration.
db_delete('rate_widget_element')
->condition('wid', $wid)
->execute();
}
$elements = rate_ui_widget_elements($storage);
foreach ($elements as $type => $name) {
$mode = 0;
foreach (array(
1,
2,
4,
8,
16,
) as $i) {
if (!empty($storage["element_{$type}_{$i}"])) {
$mode |= $i;
}
}
if ($mode) {
$element = new stdClass();
$element->wid = $wid;
$element->type = $type;
$element->prefix = $storage["element_{$type}_prefix"];
$element->suffix = $storage["element_{$type}_suffix"];
$element->weight = $storage["element_{$type}_weight"];
$element->mode = $mode;
drupal_write_record('rate_widget_element', $element);
}
}
}