You are here

function js_injector_rule_delete in JS injector 7.2

Delete a single JS injector rule. Override is required to clean up the filesystem

1 string reference to 'js_injector_rule_delete'
js_injector_schema in ./js_injector.install
Implements hook_schema().

File

./js_injector.module, line 111
js_injector.module

Code

function js_injector_rule_delete($rule) {
  $schema = ctools_export_get_schema('js_injector_rule');
  $export = $schema['export'];

  // If we were sent an object, get the export key from it. Otherwise
  // assume we were sent the export key.
  $value = is_object($rule) ? $rule->{$export['key']} : $rule;
  db_delete('js_injector_rule')
    ->condition($export['key'], $value)
    ->execute();

  // delete the JS file to the filesystem
  return file_unmanaged_delete(_js_injector_rule_uri($rule->crid));
}