Changeset 52275 for trunk/src/wp-includes/global-styles-and-settings.php
- Timestamp:
- 11/30/2021 12:22:30 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/global-styles-and-settings.php
r52232 r52275 11 11 * @since 5.9.0 12 12 * 13 * @param array $path Path to the specific setting to retrieve. Optional. 14 * If empty, will return all settings. 15 * @param string $block_name Which block to retrieve the settings from. Optional 16 * If empty, it'll return the settings for the global context. 17 * @param string $origin Which origin to take data from. Optional. 18 * It can be 'all' (core, theme, and user) or 'base' (core and theme). 19 * If empty or unknown, 'all' is used. 13 * @param array $path Path to the specific setting to retrieve. Optional. 14 * If empty, will return all settings. 15 * @param array $context { 16 * Metadata to know where to retrieve the $path from. Optional. 17 * 18 * @type string $block_name Which block to retrieve the settings from. 19 * If empty, it'll return the settings for the global context. 20 * @type string $origin Which origin to take data from. 21 * Valid values are 'all' (core, theme, and user) or 'base' (core and theme). 22 * If empty or unknown, 'all' is used. 23 * } 20 24 * 21 25 * @return array The settings to retrieve. 22 26 */ 23 function wp_get_global_settings( $path = array(), $ block_name = '', $origin = 'all') {24 if ( '' !== $block_name) {25 $path = array_merge( array( 'blocks', $ block_name), $path );27 function wp_get_global_settings( $path = array(), $context = array() ) { 28 if ( ! empty( $context['block_name'] ) ) { 29 $path = array_merge( array( 'blocks', $context['block_name'] ), $path ); 26 30 } 27 31 28 if ( 'base' === $origin ) { 32 $origin = 'custom'; 33 if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) { 29 34 $origin = 'theme'; 30 } else {31 $origin = 'user';32 35 } 33 36 … … 42 45 * @since 5.9.0 43 46 * 44 * @param array $path Path to the specific style to retrieve. Optional. 45 * If empty, will return all styles. 46 * @param string $block_name Which block to retrieve the styles from. Optional. 47 * If empty, it'll return the styles for the global context. 48 * @param string $origin Which origin to take data from. Optional. 49 * It can be 'all' (core, theme, and user) or 'base' (core and theme). 50 * If empty or unknown, 'all' is used. 47 * @param array $path Path to the specific style to retrieve. Optional. 48 * If empty, will return all styles. 49 * @param array $context { 50 * Metadata to know where to retrieve the $path from. Optional. 51 * 52 * @type string $block_name Which block to retrieve the styles from. 53 * If empty, it'll return the styles for the global context. 54 * @type string $origin Which origin to take data from. 55 * Valid values are 'all' (core, theme, and user) or 'base' (core and theme). 56 * If empty or unknown, 'all' is used. 57 * } 51 58 * 52 59 * @return array The styles to retrieve. 53 60 */ 54 function wp_get_global_styles( $path = array(), $ block_name = '', $origin = 'all') {55 if ( '' !== $block_name) {56 $path = array_merge( array( 'blocks', $ block_name), $path );61 function wp_get_global_styles( $path = array(), $context = array() ) { 62 if ( ! empty( $context['block_name'] ) ) { 63 $path = array_merge( array( 'blocks', $context['block_name'] ), $path ); 57 64 } 58 65 59 if ( 'base' === $origin ) { 66 $origin = 'custom'; 67 if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) { 60 68 $origin = 'theme'; 61 } else {62 $origin = 'user';63 69 } 64 70 … … 106 112 } 107 113 108 $origins = array( 'default', 'theme', ' user' );114 $origins = array( 'default', 'theme', 'custom' ); 109 115 if ( ! $supports_theme_json && ! $supports_link_color ) { 110 116 // In this case we only enqueue the core presets (CSS Custom Properties + the classes).
Note: See TracChangeset
for help on using the changeset viewer.