function ctools_css_assemble

Re-assemble a css string and format it nicely.

Parameters

array $css_data: An array of css data, as produced by @see ctools_css_disassemble() disassembler and the @see ctools_css_filter_css_data() filter.

Return value

string css optimized for human viewing.

2 calls to ctools_css_assemble()
CtoolsCssTestCase::testCssFilterURLHandling in tests/css.test
Test that in case that url is used, the colons survives filtering.
ctools_css_filter in includes/css.inc
Filter a chunk of CSS text.

File

includes/css.inc, line 218

Code

function ctools_css_assemble($css_data) {
    // Initialize the output.
    $css = '';
    // Iterate through all the statements.
    foreach ($css_data as $selector_str => $declaration) {
        // Add the selectors, separating them with commas and line feeds.
        $css .= strpos($selector_str, ',') === FALSE ? $selector_str : str_replace(", ", ",\n", $selector_str);
        // Add the opening curly brace.
        $css .= " {\n";
        // Iterate through all the declarations.
        foreach ($declaration as $property => $value) {
            $css .= "  " . $property . ": " . $value . ";\n";
        }
        // Add the closing curly brace.
        $css .= "}\n\n";
    }
    // Return the output.
    return $css;
}