Make WordPress Core


Ignore:
Timestamp:
05/03/2023 11:55:50 PM (2 years ago)
Author:
johnbillion
Message:

Docs: Correct and improve inline docs relating to the style engine.

See #57840

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/style-engine.php

    r54156 r55719  
    1111 */
    1212
    13 
    1413/**
    1514 * Global public interface method to generate styles from a single style object, e.g.,
     
    2019 * Example usage:
    2120 *
    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' )
    2426 *
    2527 * @access public
     
    3234 *     @type string|null $context                    An identifier describing the origin of the style object, e.g., 'block-supports' or 'global-styles'. Default is `null`.
    3335 *                                                   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`.
    3537 *     @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 }`,
    3638 *                                                   otherwise, the value will be a concatenated string of CSS declarations.
    3739 * }
    38  *
    3940 * @return array {
    4041 *     @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" )`.
    4243 *     @type string   $classnames   Classnames separated by a space.
    4344 * }
     
    7576/**
    7677 * Returns compiled CSS from a collection of selectors and declarations.
    77  * Useful for returning a compiled stylesheet from any collection of  CSS selector + declarations.
     78 * Useful for returning a compiled stylesheet from any collection of CSS selector + declarations.
    7879 *
    7980 * 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}
    8388 *
    8489 * @since 6.1.0
     
    8994 *     @type array ...$0 {
    9095 *         @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" )`.
    9297 *     }
    9398 * }
     
    100105 *     @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.
    101106 * }
    102  *
    103107 * @return string A string of compiled CSS declarations, or empty string.
    104108 */
     
    147151 *     @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.
    148152 * }
    149  *
    150153 * @return string A compiled CSS string.
    151154 */
Note: See TracChangeset for help on using the changeset viewer.