You are here

function panels_page_assemble_css in Panels 6.2

Same name and namespace in other branches
  1. 5.2 panels_page/panels_page.css_filter.inc \panels_page_assemble_css()

Re-assemble a css string and format it nicely.

Parameters

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

Return value

string $css css optimized for human viewing.

File

panels_page/panels_page.css_filter.inc, line 19

Code

function panels_page_assemble_css($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 : preg_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;
}