You are here

function slickgrid_set_settings in Slickgrid 7

Same name and namespace in other branches
  1. 6 slickgrid.module \slickgrid_set_settings()
  2. 7.2 slickgrid.module \slickgrid_set_settings()
1 call to slickgrid_set_settings()
slickgrid_callback_settings in includes/slickgrid.callbacks.inc
Callback function - update a view's settings

File

./slickgrid.module, line 303

Code

function slickgrid_set_settings($uid, $view_name, $display_id, $settings) {
  $record = new stdClass();
  $record->uid = $uid;
  $record->view_name = $view_name;
  $record->display_id = $display_id;
  if ($record->settings = slickgrid_get_settings(array(
    'uid' => $uid,
    'view_name' => $view_name,
    'display_id' => $display_id,
  ))) {
    $update = array(
      'uid',
      'view_name',
      'display_id',
    );
  }
  else {
    $update = array();
  }
  foreach ($settings as $setting => $value) {
    $record->settings[$setting] = $value;
  }
  $record->settings = serialize($record->settings);
  drupal_write_record('slickgrid', $record, $update);
}