You are here

function delta_add_override_submit in Delta 7

Same name and namespace in other branches
  1. 6 delta.module \delta_add_override_submit()
1 string reference to 'delta_add_override_submit'
delta_manage_override_form in ./delta.module

File

./delta.module, line 753
The Delta Theme API is an advanced manipulation of the Theme Settings API to allow for customization/configuration of theme settings based on node types, context, or groups of paths.

Code

function delta_add_override_submit($form, &$form_state) {
  $delta = $form_state['values'];
  $override_data = array(
    'node-types' => $delta['delta_conditions']['nodes'],
    'contexts' => $delta['delta_conditions']['contexts'],
    'paths' => $delta['delta_conditions']['paths'],
  );

  // New Override, Insert query
  if (!$delta['delta_override']['did']) {
    db_query("\n      INSERT INTO {delta_theme_overrides}  \n        (tid, system_name, name, value, weight, theme) \n      VALUES(%d, '%s', '%s', '%s', %d, '%s')", $delta['delta_override']['tst']['theme_settings_template'], t($delta['delta_override']['system_name']), t($delta['delta_override']['name']), serialize($override_data), $delta['delta_override']['weight'], $delta['delta_override']['theme']);
    drupal_set_message('New Override Saved.');
  }
  else {
    db_query("\n      UPDATE {delta_theme_overrides}  \n        SET \n          tid = %d, \n          system_name = '%s', \n          name = '%s', \n          value = '%s', \n          weight = %d, \n          theme = '%s' \n      WHERE did = %d", $delta['delta_override']['tst']['theme_settings_template'], t($delta['delta_override']['system_name']), t($delta['delta_override']['name']), serialize($override_data), $delta['delta_override']['weight'], $delta['delta_override']['theme'], $delta['delta_override']['did']);
  }

  // redirect to the settings page for the theme this override was created for
  drupal_goto('admin/build/delta/settings/' . $delta['delta_override']['theme']);
}