You are here

function ctools_css_filter in Chaos Tool Suite (ctools) 7

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

Filter a chunk of CSS text.

This function disassembles the CSS into a raw format that makes it easier for our tool to work, then runs it through the filter and reassembles it. If you find that you want the raw data for some reason or another, you can use the disassemble/assemble functions yourself.

Parameters

$css: The CSS text to filter.

$compressed: If true, generate compressed output; if false, generate pretty output. Defaults to TRUE.

2 calls to ctools_css_filter()
CtoolsCssTestCase::testCssFilterMergeProperties in tests/css.test
Test that when the CSS has two properties defined they are merged.
ctools_css_cache in includes/css.inc
Write a chunk of CSS to a temporary cache file and return the file name.

File

includes/css.inc, line 198
CSS filtering functions. Contains a disassembler, filter, compressor, and decompressor.

Code

function ctools_css_filter($css, $compressed = TRUE) {
  $css_data = ctools_css_disassemble($css);

  // Note: By using this function yourself you can control the allowed
  // properties and values list.
  $filtered = ctools_css_filter_css_data($css_data);
  return $compressed ? ctools_css_compress($filtered) : ctools_css_assemble($filtered);
}