Changeset 52320 for trunk/src/wp-includes/class-wp-theme-json.php
- Timestamp:
- 12/04/2021 12:56:29 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r52275 r52320 83 83 * (either value_key or value_func should be present) 84 84 * - css_vars => template string to use in generating the CSS Custom Property. 85 * Example output: "--wp--preset--duotone--blue: <value>" will generate as many CSS Custom Properties as presets defined 85 * Example output: "--wp--preset--duotone--blue: <value>" will generate 86 * as many CSS Custom Properties as presets defined 86 87 * substituting the $slug for the slug's value for each preset value. 87 88 * - classes => array containing a structure with the classes to … … 100 101 * 101 102 * @since 5.8.0 102 * @since 5.9.0 Added new presets and simplified the metadata structure. 103 * @since 5.9.0 Added the `color/duotone` and `typography/fontFamily` presets, 104 * simplified the metadata structure. 103 105 * @var array 104 106 */ … … 157 159 * 158 160 * @since 5.8.0 159 * @since 5.9.0 Added new properties and simplified the metadata structure. 161 * @since 5.9.0 Added the `border-*`, `font-family`, `font-style`, `font-weight`, 162 * `letter-spacing`, `margin-*`, `padding-*`, `--wp--style--block-gap`, 163 * `text-decoration`, `text-transform`, and `filter` properties, 164 * simplified the metadata structure. 160 165 * @var array 161 166 */ … … 213 218 * 214 219 * @since 5.8.0 215 * @since 5.9.0 Renamed from ALLOWED_TOP_LEVEL_KEYS and added new values. 220 * @since 5.9.0 Renamed from `ALLOWED_TOP_LEVEL_KEYS`, 221 * added the `customTemplates` and `templateParts` values. 216 222 * @var string[] 217 223 */ … … 228 234 * 229 235 * @since 5.8.0 230 * @since 5.9.0 Renamed from ALLOWED_SETTINGS, gained new properties, and renamed others according to the new schema. 236 * @since 5.9.0 Renamed from `ALLOWED_SETTINGS`, added new properties 237 * for `border`, `color`, `spacing`, and `typography`, 238 * and renamed others according to the new schema. 231 239 * @var array 232 240 */ … … 281 289 * 282 290 * @since 5.8.0 283 * @since 5.9.0 Renamed from ALLOWED_SETTINGS, gained new properties. 291 * @since 5.9.0 Renamed from `ALLOWED_SETTINGS`, added new properties 292 * for `border`, `filter`, `spacing`, and `typography`. 284 293 * @var array 285 294 */ … … 336 345 * 337 346 * @since 5.8.0 338 * @since 5.9.0 Changed value .347 * @since 5.9.0 Changed value from 1 to 2. 339 348 * @var int 340 349 */ … … 436 445 * 437 446 * @since 5.8.0 438 * @since 5.9.0 Has newparameters.439 * 440 * @param array $input Structure to sanitize.441 * @param array $valid_block_names List of valid block names.447 * @since 5.9.0 Added the `$valid_block_names` and `$valid_element_name` parameters. 448 * 449 * @param array $input Structure to sanitize. 450 * @param array $valid_block_names List of valid block names. 442 451 * @param array $valid_element_names List of valid element names. 443 452 * @return array The sanitized output. … … 519 528 * 520 529 * @since 5.8.0 521 * @since 5.9.0 Added duotonekey with CSS selector.530 * @since 5.9.0 Added `duotone` key with CSS selector. 522 531 * 523 532 * @return array Block metadata. … … 633 642 * 634 643 * @since 5.8.0 635 * @since 5.9.0 Changed the arguments passed to the function.636 * 637 * @param array $types 638 * 'variables': only the CSS Custom Properties for presets & custom ones.639 * 'styles': only the styles section in theme.json.640 * 'presets': only the classes for the presets.641 * @param array $origins A list of origins to include. By default it includes self::VALID_ORIGINS.644 * @since 5.9.0 Removed the `$type` parameter`, added the `$types` and `$origins` parameters. 645 * 646 * @param array $types Types of styles to load. Will load all by default. It accepts: 647 * - `variables`: only the CSS Custom Properties for presets & custom ones. 648 * - `styles`: only the styles section in theme.json. 649 * - `presets`: only the classes for the presets. 650 * @param array $origins A list of origins to include. By default it includes `self::VALID_ORIGINS`. 642 651 * @return string Stylesheet. 643 652 */ … … 645 654 if ( is_string( $types ) ) { 646 655 // Dispatch error and map old arguments to new ones. 647 _deprecated_argument( __FUNCTION__, '5.9 ' );656 _deprecated_argument( __FUNCTION__, '5.9.0' ); 648 657 if ( 'block_styles' === $types ) { 649 658 $types = array( 'styles', 'presets' ); … … 737 746 * 738 747 * @since 5.8.0 739 * @since 5.9.0 Renamed to get_block_classes and no longer returns preset classes. 748 * @since 5.9.0 Renamed from `get_block_styles()` to `get_block_classes()` 749 * and no longer returns preset classes. 740 750 * 741 751 * @param array $style_nodes Nodes with styles. … … 851 861 * 852 862 * @since 5.8.0 853 * @since 5.9.0 Added originsparameter.854 * 855 * @param array $nodes Nodes with settings.863 * @since 5.9.0 Added the `$origins` parameter. 864 * 865 * @param array $nodes Nodes with settings. 856 866 * @param array $origins List of origins to process. 857 867 * @return string The new stylesheet. … … 928 938 * 929 939 * @since 5.8.0 930 * @since 5.9.0 Added originsparameter.940 * @since 5.9.0 Added the `$origins` parameter. 931 941 * 932 942 * @param array $settings Settings to process. … … 980 990 * @param string $scope Selector to scope to. 981 991 * @param string $selector Original selector. 982 *983 992 * @return string Scoped selector. 984 993 */ … … 1028 1037 * @since 5.9.0 1029 1038 * 1030 * @param array $settings Settings to process.1039 * @param array $settings Settings to process. 1031 1040 * @param array $preset_metadata One of the PRESETS_METADATA values. 1032 * @param array $origins List of origins to process.1041 * @param array $origins List of origins to process. 1033 1042 * @return array Array of presets where each key is a slug and each value is the preset value. 1034 1043 */ … … 1070 1079 * @since 5.9.0 1071 1080 * 1072 * @param array $settings Settings to process.1081 * @param array $settings Settings to process. 1073 1082 * @param array $preset_metadata One of the PRESETS_METADATA values. 1074 * @param array $origins List of origins to process.1083 * @param array $origins List of origins to process. 1075 1084 * @return array Array of presets where the key and value are both the slug. 1076 1085 */ … … 1099 1108 * 1100 1109 * @param string $input String to replace. 1101 * @param string $slug The slug value to use to generate the custom property.1102 * @return string The CSS Custom Property. Something along the lines of --wp--preset--color--black.1110 * @param string $slug The slug value to use to generate the custom property. 1111 * @return string The CSS Custom Property. Something along the lines of `--wp--preset--color--black`. 1103 1112 */ 1104 1113 private static function replace_slug_in_string( $input, $slug ) { … … 1117 1126 * 1118 1127 * @since 5.8.0 1128 * @since 5.9.0 Added the `$origins` parameter. 1119 1129 * 1120 1130 * @param array $settings Settings to process. … … 1235 1245 * 1236 1246 * @since 5.8.0 1237 * @since 5.9.0 Added the me setting and propertiesparameters.1238 * 1239 * @param array $styles Styles to process.1240 * @param array $settings Theme settings.1247 * @since 5.9.0 Added the `$settings` and `$properties` parameters. 1248 * 1249 * @param array $styles Styles to process. 1250 * @param array $settings Theme settings. 1241 1251 * @param array $properties Properties metadata. 1242 1252 * @return array Returns the modified $declarations. … … 1286 1296 * 1287 1297 * @since 5.8.0 1288 * @since 5.9.0 Consider $value that are arrays as well.1298 * @since 5.9.0 Added support for values of array type, which are returned as is. 1289 1299 * 1290 1300 * @param array $styles Styles subtree. 1291 1301 * @param array $path Which property to process. 1292 * @return string Style property value.1302 * @return string|array Style property value. 1293 1303 */ 1294 1304 private static function get_property_value( $styles, $path ) { … … 1533 1543 * @since 5.9.0 1534 1544 * 1535 * @param array $data A theme.json like structure to inspect. 1536 * @param array $node_path The path to inspect. It's 'settings' by default. 1537 * 1545 * @param array $data A theme.json like structure to inspect. 1546 * @param array $node_path The path to inspect. Default is 'settings'. 1538 1547 * @return array An associative array containing the slugs for the given path. 1539 1548 */ … … 1569 1578 * @since 5.9.0 1570 1579 * 1571 * @param array $node The node with the presets to validate.1572 * @param array $path The path to the preset type to inspect.1580 * @param array $node The node with the presets to validate. 1581 * @param array $path The path to the preset type to inspect. 1573 1582 * @param array $slugs The slugs that should not be overriden. 1574 * 1575 * @return array The new node 1583 * @return array The new node. 1576 1584 */ 1577 1585 private static function filter_slugs( $node, $path, $slugs ) { … … 1740 1748 * @since 5.9.0 1741 1749 * 1742 * @param string $property_name Property name in a CSS declaration, i.e. the `color` in `color: red`.1750 * @param string $property_name Property name in a CSS declaration, i.e. the `color` in `color: red`. 1743 1751 * @param string $property_value Value in a CSS declaration, i.e. the `red` in `color: red`. 1744 * @return bool ean1752 * @return bool 1745 1753 */ 1746 1754 private static function is_safe_css_declaration( $property_name, $property_value ) {
Note: See TracChangeset
for help on using the changeset viewer.