Changeset 55719 for trunk/src/wp-includes/style-engine.php
- Timestamp:
- 05/03/2023 11:55:50 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/style-engine.php
r54156 r55719 11 11 */ 12 12 13 14 13 /** 15 14 * Global public interface method to generate styles from a single style object, e.g., … … 20 19 * Example usage: 21 20 * 22 * $styles = wp_style_engine_get_styles( array( 'color' => array( 'text' => '#cccccc' ) ) ); 23 * // Returns `array( 'css' => 'color: #cccccc', 'declarations' => array( 'color' => '#cccccc' ), 'classnames' => 'has-color' )`. 21 * $styles = wp_style_engine_get_styles( array( 'color' => array( 'text' => '#cccccc' ) ) ); 22 * 23 * Returns: 24 * 25 * array( 'css' => 'color: #cccccc', 'declarations' => array( 'color' => '#cccccc' ), 'classnames' => 'has-color' ) 24 26 * 25 27 * @access public … … 32 34 * @type string|null $context An identifier describing the origin of the style object, e.g., 'block-supports' or 'global-styles'. Default is `null`. 33 35 * When set, the style engine will attempt to store the CSS rules, where a selector is also passed. 34 * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to var( --wp--preset--* )values. Default `false`.36 * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, e.g., `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, to `var( --wp--preset--* )` values. Default `false`. 35 37 * @type string $selector Optional. When a selector is passed, the value of `$css` in the return value will comprise a full CSS rule `$selector { ...$css_declarations }`, 36 38 * otherwise, the value will be a concatenated string of CSS declarations. 37 39 * } 38 *39 40 * @return array { 40 41 * @type string $css A CSS ruleset or declarations block formatted to be placed in an HTML `style` attribute or tag. 41 * @type string[] $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).42 * @type string[] $declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`. 42 43 * @type string $classnames Classnames separated by a space. 43 44 * } … … 75 76 /** 76 77 * Returns compiled CSS from a collection of selectors and declarations. 77 * Useful for returning a compiled stylesheet from any collection of 78 * Useful for returning a compiled stylesheet from any collection of CSS selector + declarations. 78 79 * 79 80 * Example usage: 80 * $css_rules = array( array( 'selector' => '.elephant-are-cool', 'declarations' => array( 'color' => 'gray', 'width' => '3em' ) ) ); 81 * $css = wp_style_engine_get_stylesheet_from_css_rules( $css_rules ); 82 * // Returns `.elephant-are-cool{color:gray;width:3em}`. 81 * 82 * $css_rules = array( array( 'selector' => '.elephant-are-cool', 'declarations' => array( 'color' => 'gray', 'width' => '3em' ) ) ); 83 * $css = wp_style_engine_get_stylesheet_from_css_rules( $css_rules ); 84 * 85 * Returns: 86 * 87 * .elephant-are-cool{color:gray;width:3em} 83 88 * 84 89 * @since 6.1.0 … … 89 94 * @type array ...$0 { 90 95 * @type string $selector A CSS selector. 91 * @type string[] $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).96 * @type string[] $declarations An associative array of CSS definitions, e.g., `array( "$property" => "$value", "$property" => "$value" )`. 92 97 * } 93 98 * } … … 100 105 * @type bool $prettify Whether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined. 101 106 * } 102 *103 107 * @return string A string of compiled CSS declarations, or empty string. 104 108 */ … … 147 151 * @type bool $prettify Whether to add new lines and indents to output. Default is the test of whether the global constant `SCRIPT_DEBUG` is defined. 148 152 * } 149 *150 153 * @return string A compiled CSS string. 151 154 */
Note: See TracChangeset
for help on using the changeset viewer.