Editor: Allow custom-units to be an array.

The changes in [50959] introduced an issue where `custom_units` was always being coerced into a boolean value. This should support `array` values.

Props kraftner, youknowriad, nosolosw, jorgefilipecosta.
Fixes #53472.

git-svn-id: https://develop.svn.wordpress.org/trunk@51203 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2021-06-22 17:15:27 +00:00
parent 7368e86994
commit f3b1cc24e4

View File

@ -354,11 +354,7 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
unset( $editor_settings['__experimentalFeatures']['typography']['customLineHeight'] );
}
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['units'] ) ) {
if ( ! is_array( $editor_settings['__experimentalFeatures']['spacing']['units'] ) ) {
$editor_settings['enableCustomUnits'] = false;
} else {
$editor_settings['enableCustomUnits'] = count( $editor_settings['__experimentalFeatures']['spacing']['units'] ) > 0;
}
$editor_settings['enableCustomUnits'] = $editor_settings['__experimentalFeatures']['spacing']['units'];
unset( $editor_settings['__experimentalFeatures']['spacing']['units'] );
}
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['customPadding'] ) ) {