WordPress.org

Make WordPress Core

Ticket #36255: 36255.4.diff

File 36255.4.diff, 3.5 KB (added by westonruter, 6 years ago)
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index ea30b93..4d01520 100644
    final class WP_Customize_Manager { 
    18331833         * Register some default controls.
    18341834         *
    18351835         * @since 3.4.0
     1836         *
     1837         * @global array $_wp_additional_image_sizes
    18361838         */
    18371839        public function register_controls() {
     1840                global $_wp_additional_image_sizes;
    18381841
    18391842                /* Panel, Section, and Control Types */
    18401843                $this->register_panel_type( 'WP_Customize_Panel' );
    final class WP_Customize_Manager { 
    19621965                        'transport'      => 'postMessage',
    19631966                ) );
    19641967
    1965                 $this->add_control( new WP_Customize_Media_Control( $this, 'custom_logo', array(
     1968                $custom_logo_control_args = array(
    19661969                        'label'    => __( 'Logo' ),
    19671970                        'section'  => 'title_tagline',
    19681971                        'priority' => 8,
    1969                         'mime_type' => 'image',
    19701972                        'button_labels' => array(
    19711973                                'select'       => __( 'Select logo' ),
    19721974                                'change'       => __( 'Change logo' ),
    final class WP_Customize_Manager { 
    19761978                                'frame_title'  => __( 'Select logo' ),
    19771979                                'frame_button' => __( 'Choose logo' ),
    19781980                        ),
    1979                 ) ) );
     1981                );
     1982                $custom_logo_size = get_theme_support( 'custom-logo', 'size' );
     1983                if ( ! empty( $custom_logo_size ) && has_image_size( $custom_logo_size ) ) {
     1984                        $custom_logo_control_args['width'] = $_wp_additional_image_sizes[ $custom_logo_size ]['width'];
     1985                        $custom_logo_control_args['height'] = $_wp_additional_image_sizes[ $custom_logo_size ]['height'];
     1986                        $custom_logo_control_args['flex_width'] = empty( $_wp_additional_image_sizes[ $custom_logo_size ]['crop'] );
     1987                        $custom_logo_control_args['flex_height'] = empty( $_wp_additional_image_sizes[ $custom_logo_size ]['crop'] );
     1988                }
     1989                $this->add_control( new WP_Customize_Cropped_Image_Control( $this, 'custom_logo', $custom_logo_control_args ) );
    19801990
    19811991                if ( isset( $this->selective_refresh ) ) {
    19821992                        $this->selective_refresh->add_partial( 'custom_logo', array(
  • src/wp-includes/js/media-views.js

    diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
    index 015ec23..7be6868 100644
    CustomizeImageCropper = Controller.Cropper.extend({ 
    402402                var cropDetails = attachment.get( 'cropDetails' ),
    403403                        control = this.get( 'control' );
    404404
    405                 cropDetails.dst_width  = control.params.width;
    406                 cropDetails.dst_height = control.params.height;
     405                if ( ! control.params.flex_width ) {
     406                        cropDetails.dst_width = control.params.width;
     407                }
     408                if ( ! control.params.flex_height ) {
     409                        cropDetails.dst_height = control.params.height;
     410                }
    407411
    408412                return wp.ajax.post( 'crop-image', {
    409413                        wp_customize: 'on',
  • src/wp-includes/js/media/controllers/customize-image-cropper.js

    diff --git src/wp-includes/js/media/controllers/customize-image-cropper.js src/wp-includes/js/media/controllers/customize-image-cropper.js
    index dbaa8f8..df2d77b 100644
    CustomizeImageCropper = Controller.Cropper.extend({ 
    1616                var cropDetails = attachment.get( 'cropDetails' ),
    1717                        control = this.get( 'control' );
    1818
    19                 cropDetails.dst_width  = control.params.width;
    20                 cropDetails.dst_height = control.params.height;
     19                if ( ! control.params.flex_width ) {
     20                        cropDetails.dst_width = control.params.width;
     21                }
     22                if ( ! control.params.flex_height ) {
     23                        cropDetails.dst_height = control.params.height;
     24                }
    2125
    2226                return wp.ajax.post( 'crop-image', {
    2327                        wp_customize: 'on',