You are here

function colorizer_save in Colorizer 7

Saves the info for an instance

Parameters

$instance: The instance to save the data for.

$data: An array of data that corresponds to fields in table. 'stylesheet': Path to a colorizer stylesheet. 'palette': The palette for the instance. 'files': An array of files.

3 calls to colorizer_save()
colorizer_admin_form_submit in ./colorizer.admin.inc
Helper function to submit/save a colorizer form Mostly copied from Color module
colorizer_update_7100 in ./colorizer.install
colorizer_update_stylesheet in ./colorizer.module
Create a new stylesheet by replacing color variables Basic filehandling copied from Color module Returns full path to new css file

File

./colorizer.module, line 19
Colorize your theme

Code

function colorizer_save($instance, $data) {
  if ($current = colorizer_load($instance)) {
    $data += $current;
  }
  else {
    $data += array(
      'palette' => array(),
      'stylesheet' => '',
    );
  }
  $data['palette'] = serialize($data['palette']);
  db_merge('colorizer_instance')
    ->key(array(
    'instance' => $instance,
  ))
    ->fields($data)
    ->execute();
  cache_clear_all('colorizer_data_' . $instance, 'cache');
  drupal_static_reset('colorizer_load');
}