Ticket #35941: 35941.diff
| File 35941.diff, 10.0 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/css/customize-controls.css
725 725 .customize-control-background .current, 726 726 .customize-control-cropped_image .current, 727 727 .customize-control-site_icon .current, 728 .customize-control-site_logo .current,729 728 .customize-control-header .current { 730 729 margin-bottom: 8px; 731 730 } … … 767 766 .customize-control-site_icon .remove-button, 768 767 .customize-control-site_icon .default-button, 769 768 .customize-control-site_icon .upload-button, 770 .customize-control-site_logo .remove-button,771 .customize-control-site_logo .default-button,772 .customize-control-site_logo .upload-button,773 769 .customize-control-header button.new, 774 770 .customize-control-header button.remove { 775 771 white-space: normal; … … 783 779 .customize-control-background .current .container, 784 780 .customize-control-cropped_image .current .container, 785 781 .customize-control-site_icon .current .container, 786 .customize-control-site_logo .current .container,787 782 .customize-control-header .current .container { 788 783 overflow: hidden; 789 784 -webkit-border-radius: 2px; … … 797 792 .customize-control-background .current .container, 798 793 .customize-control-cropped_image .current .container, 799 794 .customize-control-site_icon .current .container, 800 .customize-control-site_logo .current .container,801 795 .customize-control-image .current .container { 802 796 min-height: 40px; 803 797 } … … 826 820 .customize-control-background .inner, 827 821 .customize-control-cropped_image .inner, 828 822 .customize-control-site_icon .inner, 829 .customize-control-site_logo .inner,830 823 .customize-control-header .inner { 831 824 display: none; 832 825 position: absolute; … … 842 835 .customize-control-background .inner, 843 836 .customize-control-cropped_image .inner, 844 837 .customize-control-site_icon .inner, 845 .customize-control-site_logo .inner,846 838 .customize-control-image .inner { 847 839 display: block; 848 840 min-height: 40px; … … 854 846 .customize-control-background .inner, 855 847 .customize-control-cropped_image .inner, 856 848 .customize-control-site_icon .inner, 857 .customize-control-site_logo.inner,858 849 .customize-control-header .inner, 859 850 .customize-control-header .inner .dashicons { 860 851 line-height: 20px; … … 954 945 100% { color: #d4b146; } 955 946 } 956 947 957 .customize-control-media .actions,958 .customize-control-upload .actions,959 .customize-control-image .actions,960 .customize-control-background .actions,961 .customize-control-cropped_image .actions,962 .customize-control-site_icon .actions,963 .customize-control-header .actions {964 margin-bottom: 32px;965 }966 967 948 .customize-control-header .choice { 968 949 position: relative; 969 950 display: block; … … 998 979 .customize-control-cropped_image .default-button, 999 980 .customize-control-site_icon .remove-button, 1000 981 .customize-control-site_icon .default-button, 1001 .customize-control-site_logo .remove-button,1002 .customize-control-site_logo .default-button,1003 982 .customize-control-header .remove { 1004 983 float: left; 1005 984 margin-right: 3px; … … 1011 990 .customize-control-background .upload-button, 1012 991 .customize-control-cropped_image .upload-button, 1013 992 .customize-control-site_icon .upload-button, 1014 .customize-control-site_logo .upload-button,1015 993 .customize-control-header .new { 1016 994 float: right; 1017 995 } -
src/wp-admin/js/customize-controls.js
1790 1790 control.pausePlayer(); 1791 1791 }); 1792 1792 1793 // Re-render whenever the control's setting changes. 1794 control.setting.bind( function () { control.renderContent(); } ); 1793 control.setting.bind( function ( value ) { 1794 // Send attachment information to the preview for possible use in `postMessage` transport. 1795 wp.media.attachment( value ).fetch().done( function() { 1796 wp.customize.previewer.send( control.setting.id + '-attachment-data', this.attributes ); 1797 } ); 1798 1799 // Re-render whenever the control's setting changes. 1800 control.renderContent(); 1801 } ); 1795 1802 }, 1796 1803 1797 1804 pausePlayer: function () { … … 2303 2310 }); 2304 2311 2305 2312 /** 2306 * A control for selecting Site Logos.2307 *2308 2313 * @class 2309 * @augments wp.customize.MediaControl2310 2314 * @augments wp.customize.Control 2311 2315 * @augments wp.customize.Class 2312 2316 */ 2313 api.SiteLogoControl = api.MediaControl.extend({2314 2315 /**2316 * When the control's DOM structure is ready,2317 * set up internal event bindings.2318 */2319 ready: function() {2320 var control = this;2321 2322 // Shortcut so that we don't have to use _.bind every time we add a callback.2323 _.bindAll( control, 'restoreDefault', 'removeFile', 'openFrame', 'select' );2324 2325 // Bind events, with delegation to facilitate re-rendering.2326 control.container.on( 'click keydown', '.upload-button', control.openFrame );2327 control.container.on( 'click keydown', '.thumbnail-image img', control.openFrame );2328 control.container.on( 'click keydown', '.default-button', control.restoreDefault );2329 control.container.on( 'click keydown', '.remove-button', control.removeFile );2330 2331 control.setting.bind( function( attachmentId ) {2332 wp.media.attachment( attachmentId ).fetch().done( function() {2333 wp.customize.previewer.send( 'site-logo-attachment-data', this.attributes );2334 } );2335 2336 // Re-render whenever the control's setting changes.2337 control.renderContent();2338 } );2339 }2340 });2341 2342 /**2343 * @class2344 * @augments wp.customize.Control2345 * @augments wp.customize.Class2346 */2347 2317 api.HeaderControl = api.Control.extend({ 2348 2318 ready: function() { 2349 2319 this.btnRemove = $('#customize-control-header_image .actions .remove'); … … 3245 3215 image: api.ImageControl, 3246 3216 cropped_image: api.CroppedImageControl, 3247 3217 site_icon: api.SiteIconControl, 3248 site_logo: api.SiteLogoControl,3249 3218 header: api.HeaderControl, 3250 3219 background: api.BackgroundControl, 3251 3220 theme: api.ThemeControl -
src/wp-includes/class-wp-customize-manager.php
217 217 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php' ); 218 218 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php' ); 219 219 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' ); 220 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-logo-control.php' );221 220 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php' ); 222 221 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' ); 223 222 require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' ); … … 1861 1860 $this->register_control_type( 'WP_Customize_Background_Image_Control' ); 1862 1861 $this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); 1863 1862 $this->register_control_type( 'WP_Customize_Site_Icon_Control' ); 1864 $this->register_control_type( 'WP_Customize_Site_Logo_Control' );1865 1863 $this->register_control_type( 'WP_Customize_Theme_Control' ); 1866 1864 1867 1865 /* Themes */ … … 1978 1976 'transport' => 'postMessage', 1979 1977 ) ); 1980 1978 1981 $this->add_control( new WP_Customize_ Site_Logo_Control( $this, 'site_logo', array(1979 $this->add_control( new WP_Customize_Media_Control( $this, 'site_logo', array( 1982 1980 'label' => __( 'Logo' ), 1983 1981 'section' => 'title_tagline', 1984 1982 'priority' => 0, 1983 'mime_type' => 'image', 1984 'button_labels' => array( 1985 'select' => __( 'Select logo' ), 1986 'change' => __( 'Change logo' ), 1987 'remove' => __( 'Remove' ), 1988 'default' => __( 'Default' ), 1989 'placeholder' => __( 'No logo selected' ), 1990 'frame_title' => __( 'Select logo' ), 1991 'frame_button' => __( 'Choose logo' ), 1992 ), 1985 1993 ) ) ); 1986 1994 1987 1995 if ( isset( $this->selective_refresh ) ) { -
src/wp-includes/customize/class-wp-customize-site-logo-control.php
1 <?php2 /**3 * Customize API: WP_Customize_Site_Logo_Control class4 *5 * @package WordPress6 * @subpackage Customize7 * @since 4.5.08 */9 10 /**11 * Customize Site Logo control class.12 *13 * Used only for custom functionality in JavaScript.14 *15 * @since 4.5.016 *17 * @see WP_Customize_Image_Control18 */19 class WP_Customize_Site_Logo_Control extends WP_Customize_Image_Control {20 21 /**22 * Control type.23 *24 * @since 4.5.025 * @access public26 * @var string27 */28 public $type = 'site_logo';29 30 /**31 * Constructor.32 *33 * @since 4.5.034 * @access public35 *36 * @param WP_Customize_Manager $manager Customizer bootstrap instance.37 * @param string $id Control ID.38 * @param array $args Optional. Arguments to override class property defaults.39 */40 public function __construct( $manager, $id, $args = array() ) {41 parent::__construct( $manager, $id, $args );42 43 $this->button_labels = array(44 'select' => __( 'Select logo' ),45 'change' => __( 'Change logo' ),46 'remove' => __( 'Remove' ),47 'default' => __( 'Default' ),48 'placeholder' => __( 'No logo selected' ),49 'frame_title' => __( 'Select logo' ),50 'frame_button' => __( 'Choose logo' ),51 );52 }53 } -
src/wp-includes/js/customize-preview.js
234 234 * 235 235 * @since 4.5.0 236 236 */ 237 api.preview.bind( 'site -logo-attachment-data', function( attachment ) {237 api.preview.bind( 'site_logo-attachment-data', function( attachment ) { 238 238 var $logo = $( '.site-logo' ), 239 239 size = $logo.data( 'size' ), 240 240 srcset = [];