Make WordPress Core


Ignore:
Timestamp:
09/20/2023 07:04:59 AM (18 months ago)
Author:
isabel_brison
Message:

Editor: update docs for css_var.

Updates inline doc for the css_var key value pair in WP_Style_Engine.

Props ramonopoly.
Fixes #59401.

File:
1 edited

Legend:

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

    r56614 r56630  
    2828final class WP_Style_Engine {
    2929    /**
    30      * Style definitions that contain the instructions to
    31      * parse/output valid Gutenberg styles from a block's attributes.
    32      *
    33      * For every style definition, the following properties are valid:
    34      *
    35      *  - classnames    => (array) An array of classnames to be returned for block styles.
    36      *                     The key is a classname or pattern.
    37      *                     A value of `true` means the classname should be applied always.
    38      *                     Otherwise, a valid CSS property (string) to match the incoming value,
    39      *                     e.g. "color" to match var:preset|color|somePresetSlug.
    40      *  - css_vars      => (array) An array of key value pairs used to generate CSS var values.
    41      *                     The key is a CSS var pattern, whose `$slug` fragment will be replaced with a preset slug.
    42      *                     The value should be a valid CSS property (string) to match the incoming value,
    43      *                     e.g. "color" to match var:preset|color|somePresetSlug.
    44      *  - property_keys => (array) An array of keys whose values represent a valid CSS property,
    45      *                     e.g. "margin" or "border".
    46      *  - path          => (array) A path that accesses the corresponding style value in the block style object.
    47      *  - value_func    => (string) The name of a function to generate a CSS definition array
    48      *                     for a particular style object. The output of this function should be
    49      *                     `array( "$property" => "$value", ... )`.
     30     * Style definitions that contain the instructions to parse/output valid Gutenberg styles from a block's attributes.
     31     *
     32     * For every style definition, the follow properties are valid:
     33     *
     34     *  - classnames    => (array) an array of classnames to be returned for block styles. The key is a classname or pattern.
     35     *                    A value of `true` means the classname should be applied always. Otherwise, a valid CSS property (string)
     36     *                    to match the incoming value, e.g., "color" to match var:preset|color|somePresetSlug.
     37     *  - css_vars      => (array) an array of key value pairs used to generate CSS var values.
     38     *                     The key should be the CSS property name that matches the second element of the preset string value,
     39     *                     i.e., "color" in var:preset|color|somePresetSlug. The value is a CSS var pattern (e.g. `--wp--preset--color--$slug`),
     40     *                     whose `$slug` fragment will be replaced with the preset slug, which is the third element of the preset string value,
     41     *                     i.e., `somePresetSlug` in var:preset|color|somePresetSlug.
     42     *  - property_keys => (array) array of keys whose values represent a valid CSS property, e.g., "margin" or "border".
     43     *  - path          => (array) a path that accesses the corresponding style value in the block style object.
     44     *  - value_func    => (string) the name of a function to generate a CSS definition array for a particular style object. The output of this function should be `array( "$property" => "$value", ... )`.
    5045     *
    5146     * @since 6.1.0
Note: See TracChangeset for help on using the changeset viewer.