function responsive_preview_update_device_listing_values in Responsive Theme Preview 7
Updates devices defintions from form values.
Parameters
Array $devices: The form values that represent a list of devices.
See also
responsive_preview_admin_form()
1 call to responsive_preview_update_device_listing_values()
- responsive_preview_admin_form_submit in ./
responsive_preview.admin.inc - Form submit handler for responsive_preview_admin_form().
File
- ./
responsive_preview.admin.inc, line 360 - Administrative page callbacks for the responsive_preview module.
Code
function responsive_preview_update_device_listing_values($devices) {
$transaction = db_transaction();
try {
foreach ($devices as $device) {
db_update('responsive_preview')
->fields(array(
'status' => $device['status'],
'weight' => $device['weight'],
))
->condition('name', $device['name'])
->execute();
}
} catch (Exception $e) {
$transaction
->rollback();
watchdog_exception('responsive_preview', $e);
throw $e;
}
drupal_set_message(t('The device settings have been updated.'));
cache_clear_all('responsive_preview', 'cache', TRUE);
}