Make WordPress Core


Ignore:
Timestamp:
11/09/2021 02:15:23 AM (3 years ago)
Author:
noisysocks
Message:

Add Site Editor and PHP changes from Gutenberg 10.1 - 11.9

  • First pass at adding the site editor from the Gutenberg plugin to wp-admin/site-editor.php.
  • Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.

Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/border.php

    r51298 r52069  
    6464        isset( $block_attributes['style']['border']['radius'] )
    6565    ) {
    66         $border_radius = (int) $block_attributes['style']['border']['radius'];
    67         $styles[]      = sprintf( 'border-radius: %dpx;', $border_radius );
     66        $border_radius = $block_attributes['style']['border']['radius'];
     67
     68        if ( is_array( $border_radius ) ) {
     69            // We have individual border radius corner values.
     70            foreach ( $border_radius as $key => $radius ) {
     71                // Convert CamelCase corner name to kebab-case.
     72                $corner   = strtolower( preg_replace( '/(?<!^)[A-Z]/', '-$0', $key ) );
     73                $styles[] = sprintf( 'border-%s-radius: %s;', $corner, $radius );
     74            }
     75        } else {
     76            // This check handles original unitless implementation.
     77            if ( is_numeric( $border_radius ) ) {
     78                $border_radius .= 'px';
     79            }
     80
     81            $styles[] = sprintf( 'border-radius: %s;', $border_radius );
     82        }
    6883    }
    6984
     
    8297        isset( $block_attributes['style']['border']['width'] )
    8398    ) {
    84         $border_width = intval( $block_attributes['style']['border']['width'] );
    85         $styles[]     = sprintf( 'border-width: %dpx;', $border_width );
     99        $border_width = $block_attributes['style']['border']['width'];
     100
     101        // This check handles original unitless implementation.
     102        if ( is_numeric( $border_width ) ) {
     103            $border_width .= 'px';
     104        }
     105
     106        $styles[] = sprintf( 'border-width: %s;', $border_width );
    86107    }
    87108
Note: See TracChangeset for help on using the changeset viewer.