Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
343fafc
Refactor magic number to constant
ajlende May 21, 2024
21cf2ba
Add defaultSpacingSizes option
ajlende May 30, 2024
119bff1
Add migration docs
ajlende May 22, 2024
f19da26
Update API docs
ajlende May 22, 2024
9ede3bb
Refactor to not need constants
ajlende May 22, 2024
b3f304b
Update PHPUnit tests
ajlende May 22, 2024
666fc4e
Fix PHP lint
ajlende May 22, 2024
0301b49
Fix PHP lint
ajlende May 22, 2024
f5010ef
Make sure all spread vairables cannot be null
ajlende May 22, 2024
6fbb99f
Code cleanup
ajlende May 22, 2024
b1126b7
Add backport-changelog
ajlende May 23, 2024
8a5f339
Prevent spacingSizes from entirely replacing presets generated from s…
ajlende May 29, 2024
73d63a7
Be more specific about limits in the schema
ajlende May 29, 2024
ada604b
Move comment
ajlende May 29, 2024
882f02e
Increase limit to 10
ajlende May 30, 2024
3415b6a
Fix merging of origins
ajlende May 30, 2024
8529aef
Use old when checking for existance in migration
ajlende May 30, 2024
5d2762a
Fix copy/paste mistake
ajlende May 30, 2024
8093334
Fix some v2 backcompat
ajlende May 30, 2024
59eaac3
Don't bother with skipping pre-generation on v2 for filters
ajlende May 30, 2024
1aafb16
Switch back to numbers for labels in the range control
ajlende May 30, 2024
21e6de7
Deprecate set_spacing_sizes
ajlende May 30, 2024
d42932b
Remove comment
ajlende May 30, 2024
c5778d0
Remove incorrect doc param
ajlende May 30, 2024
31ac387
Clarify comment
ajlende May 30, 2024
17db2d4
Add method version docs
ajlende May 30, 2024
25dc819
Fix PHPUnit tests
ajlende May 30, 2024
144dc5a
Fix PHPUnit tests
ajlende May 30, 2024
a592617
Revert to bugged spacing scale check
ajlende May 30, 2024
1a3d0c2
Add comment about bad conditional
ajlende May 30, 2024
12edffa
Do sorting on all presets in UI only
ajlende May 30, 2024
44bf7b8
Add a check that slug begins with a number for sorting
ajlende May 30, 2024
de077ad
Reorder schema keys
ajlende May 30, 2024
d9c5c85
Quick fix for redundant info in the defaultFontSizes migration docs
ajlende May 31, 2024
1dfcaa3
Update defaultSpacingSizes migration docs to include merging of spaci…
ajlende May 31, 2024
2af96a3
Update the global settings and styles guide
ajlende May 31, 2024
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
Revert to bugged spacing scale check
  • Loading branch information
ajlende committed May 30, 2024
commit a59261704ea134efa67d88f516595d9eca056f16
56 changes: 3 additions & 53 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,51 +618,6 @@ class WP_Theme_JSON_Gutenberg {
'typography' => 'typography',
);

/**
* List of valid settings.spacing.spacingScale.units values.
*
* @since 6.6.0
* @var array
*/
const VALID_SPACING_UNITS = array(
'px',
'em',
'rem',
'%',
'vw',
'svw',
'lvw',
'dvw',
'vh',
'svh',
'lvh',
'dvh',
'vi',
'svi',
'lvi',
'dvi',
'vb',
'svb',
'lvb',
'dvb',
'vmin',
'svmin',
'lvmin',
'dvmin',
'vmax',
'svmax',
'lvmax',
'dvmax',
);

/**
* List of valid settings.spacing.spacingScale.operator values.
*
* @since 6.6.0
* @var array
*/
const VALID_SPACING_OPERATORS = array( '+', '*' );

/**
* Return the input schema at the root and per origin.
*
Expand Down Expand Up @@ -3949,19 +3904,14 @@ private static function compute_spacing_sizes( $spacing_scale ) {
if (
! isset( $spacing_scale['steps'] ) ||
! is_numeric( $spacing_scale['steps'] ) ||
! is_int( $spacing_scale['steps'] + 0 ) ||
$spacing_scale['steps'] <= 0 ||
$spacing_scale['steps'] > 10 ||
0 === $spacing_scale['steps'] ||
! isset( $spacing_scale['mediumStep'] ) ||
! is_numeric( $spacing_scale['mediumStep'] ) ||
$spacing_scale['mediumStep'] <= 0 ||
! isset( $spacing_scale['unit'] ) ||
! in_array( $spacing_scale['unit'], static::VALID_SPACING_UNITS, true ) ||
! isset( $spacing_scale['operator'] ) ||
! in_array( $spacing_scale['operator'], static::VALID_SPACING_OPERATORS, true ) ||
( '+' !== $spacing_scale['operator'] && '*' !== $spacing_scale['operator'] ) ||
! isset( $spacing_scale['increment'] ) ||
! is_numeric( $spacing_scale['increment'] ) ||
$spacing_scale['increment'] <= 0
! is_numeric( $spacing_scale['increment'] )
) {
return array();
}
Expand Down