You are here

function js_injector_edit_save in JS injector 7

Same name and namespace in other branches
  1. 6.2 js_injector.admin.inc \js_injector_edit_save()
  2. 6 js_injector.admin.inc \js_injector_edit_save()

Submit button callback for the JS rule edit form.

1 call to js_injector_edit_save()
js_injector_edit_save_and_continue in ./js_injector.admin.inc
Save and continue callback for the JS rule edit form.
1 string reference to 'js_injector_edit_save'
js_injector_edit in ./js_injector.admin.inc
Form builder function for the JS rule edit form.

File

./js_injector.admin.inc, line 220
js_injector.admin.inc Administrative interface for JS Injector.

Code

function js_injector_edit_save($form, &$form_state) {
  $rule = $form_state['values'];
  $crid = !empty($form_state['values']['crid']) ? $form_state['values']['crid'] : NULL;
  drupal_write_record('js_injector_rule', $rule, empty($crid) ? array() : 'crid');
  $form_state['values']['rule'] = $rule;
  file_unmanaged_save_data($rule['js_text'], _js_injector_rule_uri($rule['crid']), FILE_EXISTS_REPLACE);
  _js_injector_load_rule(NULL, TRUE);
  drupal_set_message(t('Your JS injection rule %title was saved.', array(
    '%title' => $rule['title'],
  )));
  $form_state['redirect'] = 'admin/config/development/js-injector';
}