You are here

function panels_page_compress_css in Panels 5.2

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

Compress css data (filter it first!) to optimize for use on view.

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 use.

1 call to panels_page_compress_css()
panels_page_view_page in panels_page/panels_page.module
Page callback to view a panel page.

File

panels_page/panels_page.css_filter.inc, line 48

Code

function panels_page_compress_css($css_data) {

  // Initialize the output.
  $css = '';

  // Iterate through all the statements.
  foreach ($css_data as $selector_str => $declaration) {
    if (empty($declaration)) {

      // Skip this statement if filtering removed all parts of the declaration.
      continue;
    }

    // Add the selectors, separating them with commas.
    $css .= $selector_str;

    // And, the opening curly brace.
    $css .= "{";

    // Iterate through all the statement properties.
    foreach ($declaration as $property => $value) {
      $css .= $property . ':' . $value . ';';
    }

    // Add the closing curly brace.
    $css .= "}";
  }

  // Return the output.
  return $css;
}