You are here

function css_injector_rule_delete in CSS Injector 7.2

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

1 string reference to 'css_injector_rule_delete'
css_injector_schema in ./css_injector.install
Implements hook_schema().

File

./css_injector.module, line 111
css_injector.module

Code

function css_injector_rule_delete($rule) {
  $schema = ctools_export_get_schema('css_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('css_injector_rule')
    ->condition($export['key'], $value)
    ->execute();

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