WP_Style_Engine::compile_css() – Returns compiled CSS from css_declarations.

You appear to be a bot. Output may be restricted

Description

Returns compiled CSS from css_declarations.

Usage

$string = WP_Style_Engine::compile_css( $css_declarations, $css_selector );

Parameters

$css_declarations
( string[] ) required – An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
$css_selector
( string ) required – When a selector is passed, the function will return a full CSS rule `$selector { …rules }`, otherwise a concatenated string of properties and values.

Returns

string A compiled CSS string.

Source

File name: wordpress/wp-includes/style-engine/class-wp-style-engine.php


Lines:

1 to 15 of 15
  public static function compile_css( $css_declarations, $css_selector ) {
    if ( empty( $css_declarations ) || ! is_array( $css_declarations ) ) {
      return '';
    }

    // Return an entire rule if there is a selector.
    if ( $css_selector ) {
      $css_rule = new WP_Style_Engine_CSS_Rule( $css_selector, $css_declarations );
      return $css_rule->get_css();
    }

    $css_declarations = new WP_Style_Engine_CSS_Declarations( $css_declarations );
    return $css_declarations->get_declarations_string();
  }
 

 View on GitHub View on Trac