-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Typography: Stabilize typography block supports within block processi…
…ng (#63401) * Try stabilizing typography block supports within block processing * Update test * Try PHP equivalent * Add backport changelog entry * Update so that writingMode is not stabilized * Add tests for the PHP implementation * Alphabetize * Move the PHP transformation to the compat directory so that it can be removed once 6.7 is the required minimum version * Update filter priority * Update phpunit/block-supports/typography-test.php Co-authored-by: Aaron Robertshaw <[email protected]> * Update phpunit/block-supports/typography-test.php Co-authored-by: Aaron Robertshaw <[email protected]> * Update phpunit/block-supports/typography-test.php Co-authored-by: Aaron Robertshaw <[email protected]> * Update phpunit/block-supports/typography-test.php Co-authored-by: Aaron Robertshaw <[email protected]> * Perform transformation a second time after applying filters * Move to 6.8 directory --------- Co-authored-by: Aaron Robertshaw <[email protected]> Co-authored-by: andrewserong <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: gziolo <[email protected]> Co-authored-by: ndiego <[email protected]> Co-authored-by: justintadlock <[email protected]> Co-authored-by: annezazu <[email protected]>
- Loading branch information
1 parent
49c3bf9
commit 48341a1
Showing
12 changed files
with
565 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
https://github.com/WordPress/wordpress-develop/pull/7069 | ||
|
||
* https://github.com/WordPress/gutenberg/pull/63401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* Temporary compatibility shims for block APIs present in Gutenberg. | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
/** | ||
* Filters the block type arguments during registration to stabilize experimental block supports. | ||
* | ||
* This is a temporary compatibility shim as the approach in core is for this to be handled | ||
* within the WP_Block_Type class rather than requiring a filter. | ||
* | ||
* @param array $args Array of arguments for registering a block type. | ||
* @return array Array of arguments for registering a block type. | ||
*/ | ||
function gutenberg_stabilize_experimental_block_supports( $args ) { | ||
if ( empty( $args['supports']['typography'] ) ) { | ||
return $args; | ||
} | ||
|
||
$experimental_typography_supports_to_stable = array( | ||
'__experimentalFontFamily' => 'fontFamily', | ||
'__experimentalFontStyle' => 'fontStyle', | ||
'__experimentalFontWeight' => 'fontWeight', | ||
'__experimentalLetterSpacing' => 'letterSpacing', | ||
'__experimentalTextDecoration' => 'textDecoration', | ||
'__experimentalTextTransform' => 'textTransform', | ||
); | ||
|
||
$current_typography_supports = $args['supports']['typography']; | ||
$stable_typography_supports = array(); | ||
|
||
foreach ( $current_typography_supports as $key => $value ) { | ||
if ( array_key_exists( $key, $experimental_typography_supports_to_stable ) ) { | ||
$stable_typography_supports[ $experimental_typography_supports_to_stable[ $key ] ] = $value; | ||
} else { | ||
$stable_typography_supports[ $key ] = $value; | ||
} | ||
} | ||
|
||
$args['supports']['typography'] = $stable_typography_supports; | ||
|
||
return $args; | ||
} | ||
|
||
add_filter( 'register_block_type_args', 'gutenberg_stabilize_experimental_block_supports', PHP_INT_MAX, 1 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.