You are here

function ctools_css_store in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/css.inc \ctools_css_store()

Store CSS with a given id and return the filename to use.

This function associates a piece of CSS with an id, and stores the cached filename and the actual CSS for later use with ctools_css_retrieve.

1 call to ctools_css_store()
ctools_stylizer_build_style in includes/stylizer.inc
Build the files for a stylizer given the proper settings.

File

includes/css.inc, line 68

Code

function ctools_css_store($id, $css, $filter = TRUE) {
  $filename = db_result(db_query("SELECT filename FROM {ctools_css_cache} WHERE cid = '%s'", $id));
  if ($filename && file_exists($filename)) {
    file_delete($filename);
  }

  // Remove any previous records.
  db_query("DELETE FROM {ctools_css_cache} WHERE cid = '%s'", $id);
  $filename = ctools_css_cache($css, $filter);
  db_query("INSERT INTO {ctools_css_cache} (cid, filename, css, filter) VALUES ('%s', '%s', '%s', %d)", $id, $filename, $css, $filter);
  return $filename;
}