[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> style-engine.php (summary)

Style engine: Public functions This file contains a variety of public functions developers can use to interact with the Style Engine API.

File Size: 193 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 functions

  wp_style_engine_get_styles()
  wp_style_engine_get_stylesheet_from_css_rules()
  wp_style_engine_get_stylesheet_from_context()

Functions
Functions that are not part of a class:

wp_style_engine_get_styles( $block_styles, $options = array()   X-Ref
Global public interface method to generate styles from a single style object,
e.g. the value of a block's attributes.style object or the top level styles in theme.json.

Example usage:

$styles = wp_style_engine_get_styles(
array(
'color' => array( 'text' => '#cccccc' ),
)
);

Returns:

array(
'css'          => 'color: #cccccc',
'declarations' => array( 'color' => '#cccccc' ),
'classnames'   => 'has-color',
)

param: array $block_styles The style object.
param: array $options {
return: array {

wp_style_engine_get_stylesheet_from_css_rules( $css_rules, $options = array()   X-Ref
Returns compiled CSS from a collection of selectors and declarations.
Useful for returning a compiled stylesheet from any collection of CSS selector + declarations.

Example usage:

$css_rules = array(
array(
'selector'     => '.elephant-are-cool',
'declarations' => array(
'color' => 'gray',
'width' => '3em',
),
),
);

$css = wp_style_engine_get_stylesheet_from_css_rules( $css_rules );

Returns:

.elephant-are-cool{color:gray;width:3em}

param: array $css_rules {
param: array $options {
return: string A string of compiled CSS declarations, or empty string.

wp_style_engine_get_stylesheet_from_context( $context, $options = array()   X-Ref
Returns compiled CSS from a store, if found.

param: string $context A valid context name, corresponding to an existing store key.
param: array  $options {
return: string A compiled CSS string.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref