Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0936195
Add WP_Theme_JSON class from core and call it WP_Theme_JSON_Gutenberg
oandregal Dec 14, 2022
49438da
compat/6.1: add missing outline properties
oandregal Dec 14, 2022
62e8eda
compat/6.1: add missing backport for constructor
oandregal Dec 14, 2022
77c14ab
compat/6.1: get_blocks_metadata
oandregal Dec 14, 2022
fdb76a5
compat/6.1: get_style_nodes add missing backport
oandregal Dec 14, 2022
db229c9
compat/6.1: get_style_nodes & get_block_nodes add missing backport
oandregal Dec 14, 2022
c7647d9
compat/6.1: add missing backport for get_stylesheet
oandregal Dec 14, 2022
ddb2db2
compat/6.1: update_separator_declarations
oandregal Dec 15, 2022
29a0a2a
compat/6.1: get_root_layout_rules
oandregal Dec 15, 2022
925ff87
compat/6.1: get_property_value
oandregal Dec 15, 2022
0ae5b88
compat/6.1: set_spacing_sizes
oandregal Dec 15, 2022
986ec3d
Fix lint issues
oandregal Dec 15, 2022
2ff5a80
Port compat/6.2 dimensions
oandregal Dec 15, 2022
4294dfc
Port compat/6.2 custom css
oandregal Dec 15, 2022
af1db74
Port compat/6.2 indirect properties
oandregal Dec 15, 2022
5f21cca
Remove no longer necessary theme.json class for 6.2
oandregal Dec 15, 2022
19f6ea5
Remove no longer necessary theme.json class for 6.1
oandregal Dec 15, 2022
381078c
Remove no longer necesary experimental theme.json class
oandregal Dec 15, 2022
3fbc491
Update PHPDoc: set class metadata to Gutenberg
oandregal Dec 15, 2022
1d5c557
Use functions from Gutenberg, not core
oandregal Dec 15, 2022
230ba74
Fix bug introduced by core refactor
oandregal Dec 15, 2022
9df365e
Remove trailing whitespace and fix tests
oandregal Dec 15, 2022
2111d11
Add back missing remove_insecure_properties method from core
oandregal Dec 15, 2022
61b368f
Move theme.json class to lib/
oandregal Dec 15, 2022
768761c
Add missing PHPdoc
oandregal Dec 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix lint issues
  • Loading branch information
oandregal committed Dec 15, 2022
commit 986ec3d49021547e29128cc0bb381c8a91995827
42 changes: 24 additions & 18 deletions lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -1562,10 +1562,12 @@ protected static function replace_slug_in_string( $input, $slug ) {
* for the presets and adds them to the $declarations array
* following the format:
*
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```php
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```
*
* @since 5.8.0
* @since 5.9.0 Added the `$origins` parameter.
Expand Down Expand Up @@ -1594,10 +1596,12 @@ protected static function compute_preset_vars( $settings, $origins ) {
* for the custom values and adds them to the $declarations
* array following the format:
*
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```php
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```
*
* @since 5.8.0
*
Expand Down Expand Up @@ -1681,10 +1685,12 @@ protected static function flatten_tree( $tree, $prefix = '', $token = '--' ) {
* Given a styles array, it extracts the style properties
* and adds them to the $declarations array following the format:
*
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```php
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```
*
* @since 5.8.0
* @since 5.9.0 Added the `$settings` and `$properties` parameters.
Expand Down Expand Up @@ -1824,7 +1830,7 @@ protected static function get_property_value( $styles, $path, $theme_json = null
'get_property_value',
sprintf(
/* translators: 1: theme.json, 2: Value name, 3: Value path, 4: Another value name. */
__( 'Your %1$s file uses a dynamic value (%2$s) for the path at %3$s. However, the value at %3$s is also a dynamic value (pointing to %4$s) and pointing to another dynamic value is not supported. Please update %3$s to point directly to %4$s.' ),
__( 'Your %1$s file uses a dynamic value (%2$s) for the path at %3$s. However, the value at %3$s is also a dynamic value (pointing to %4$s) and pointing to another dynamic value is not supported. Please update %3$s to point directly to %4$s.', 'gutenberg' ),
'theme.json',
$ref_value_string,
$path_string,
Expand Down Expand Up @@ -2015,7 +2021,7 @@ public function get_styles_block_nodes() {
*/
private static function update_separator_declarations( $declarations ) {
// Gutenberg and core implementation differed.
// https://github.com/WordPress/gutenberg/pull/44943
// https://github.com/WordPress/gutenberg/pull/44943.
$background_color = '';
$border_color_matches = false;
$text_color_matches = false;
Expand Down Expand Up @@ -3110,7 +3116,7 @@ public function set_spacing_sizes() {
|| ! is_numeric( $spacing_scale['mediumStep'] )
|| ( '+' !== $spacing_scale['operator'] && '*' !== $spacing_scale['operator'] ) ) {
if ( ! empty( $spacing_scale ) ) {
trigger_error( __( 'Some of the theme.json settings.spacing.spacingScale values are invalid' ), E_USER_NOTICE );
trigger_error( __( 'Some of the theme.json settings.spacing.spacingScale values are invalid', 'gutenberg' ), E_USER_NOTICE );
}
return null;
}
Expand Down Expand Up @@ -3144,7 +3150,7 @@ public function set_spacing_sizes() {

$below_sizes[] = array(
/* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Small. */
'name' => $below_midpoint_count === $steps_mid_point - 1 ? __( 'Small' ) : sprintf( __( '%sX-Small' ), (string) $x_small_count ),
'name' => $below_midpoint_count === $steps_mid_point - 1 ? __( 'Small', 'gutenberg' ) : sprintf( __( '%sX-Small', 'gutenberg' ), (string) $x_small_count ),
'slug' => (string) $slug,
'size' => round( $current_step, 2 ) . $unit,
);
Expand All @@ -3163,7 +3169,7 @@ public function set_spacing_sizes() {
$below_sizes = array_reverse( $below_sizes );

$below_sizes[] = array(
'name' => __( 'Medium' ),
'name' => __( 'Medium', 'gutenberg' ),
'slug' => '50',
'size' => $spacing_scale['mediumStep'] . $unit,
);
Expand All @@ -3181,7 +3187,7 @@ public function set_spacing_sizes() {

$above_sizes[] = array(
/* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Large. */
'name' => 0 === $above_midpoint_count ? __( 'Large' ) : sprintf( __( '%sX-Large' ), (string) $x_large_count ),
'name' => 0 === $above_midpoint_count ? __( 'Large', 'gutenberg' ) : sprintf( __( '%sX-Large', 'gutenberg' ), (string) $x_large_count ),
'slug' => (string) $slug,
'size' => round( $current_step, 2 ) . $unit,
);
Expand Down