function ctools_css_retrieve in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 includes/css.inc \ctools_css_retrieve()
Retrieve a filename associated with an id of previously cached CSS.
This will ensure the file still exists and, if not, create it.
2 calls to ctools_css_retrieve()
- CtoolsCssTestCase::testCssStoreFilterRetrieve in tests/
css.test - Test that Stored CSS snippets can be retrieved, filtered or otherwise.
- ctools_stylizer_add_css in includes/
stylizer.inc - Add the necessary CSS for a stylizer plugin to the page.
File
- includes/
css.inc, line 97 - CSS filtering functions. Contains a disassembler, filter, compressor, and decompressor.
Code
function ctools_css_retrieve($id) {
$cache = db_query('SELECT * FROM {ctools_css_cache} WHERE cid = :cid', array(
':cid' => $id,
))
->fetchObject();
if (!$cache) {
return;
}
if (!file_exists($cache->filename)) {
$filename = ctools_css_cache($cache->css, $cache->filter);
if ($filename != $cache->filename) {
db_update('ctools_css_cache')
->fields(array(
'filename' => $filename,
))
->condition('cid', $id)
->execute();
$cache->filename = $filename;
}
}
return $cache->filename;
}