Skip to content

Commit

Permalink
Apply class-theme-json.php patch
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed Nov 29, 2021
1 parent 8e9e04d commit b3f4e8f
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/wp-includes/class-wp-theme-json.php
Expand Up @@ -75,17 +75,28 @@ class WP_Theme_JSON {
* This contains the necessary metadata to process them:
*
* - path => where to find the preset within the settings section
+ * - override => whether a theme preset with the same slug as a default preset
+ * can override it
* - override => whether a theme preset with the same slug as a default preset
* can override it
* - value_key => the key that represents the value
* - value_func => the callback to render the value (either value_key or value_func should be present)
* - value_func => optionally, instead of value_key, a function to generate
* the value that takes a preset as an argument
* (either value_key or value_func should be present)
* - css_vars => template string to use in generating the CSS Custom Property.
* Example output: "--wp--preset--duotone--blue: <value>" will generate as many CSS Custom Properties as presets defined
* substituting the $slug for the slug's value for each preset value.
* - classes => array containing a structure with the classes to generate for the presets.
* Each key is a template string to resolve similarly to the css_vars and each value is the CSS property to use for that class.
* Example output: ".has-blue-color { color: <value> }"
* - properties => a list of CSS properties to be used by kses to check the preset value is safe.
* - classes => array containing a structure with the classes to
* generate for the presets, where for each array item
* the key is the class name and the value the property name.
* The "$slug" substring will be replaced by the slug of each preset.
* For example:
* 'classes' => array(
* '.has-$slug-color' => 'color',
* '.has-$slug-background-color' => 'background-color',
* '.has-$slug-border-color' => 'border-color',
* )
* - properties => array of CSS properties to be used by kses to
* validate the content of each preset
* by means of the remove_insecure_properties method.
*
* @since 5.8.0
* @since 5.9.0 Added new presets and simplified the metadata structure.
Expand Down Expand Up @@ -305,6 +316,8 @@ class WP_Theme_JSON {
);

/**
* The valid elements that can be found under styles.
*
* @since 5.8.0
* @var string[]
*/
Expand Down Expand Up @@ -479,6 +492,7 @@ private static function sanitize( $input, $valid_block_names, $valid_element_nam

return $output;
}

/**
* Returns the metadata for each block.
*
Expand Down

0 comments on commit b3f4e8f

Please sign in to comment.