Ticket #29211: 29211.3.diff
File 29211.3.diff, 24.9 KB (added by , 10 years ago) |
---|
-
src/wp-admin/css/customize-controls.css
762 762 .customize-control-upload .current, 763 763 .customize-control-image .current, 764 764 .customize-control-background .current, 765 .customize-control-cropimage .current, 765 766 .customize-control-header .current { 766 767 margin-bottom: 8px; 767 768 } … … 797 798 .customize-control-background .remove-button, 798 799 .customize-control-background .default-button, 799 800 .customize-control-background .upload-button, 801 .customize-control-cropimage .remove-button, 802 .customize-control-cropimage .default-button, 803 .customize-control-cropimage .upload-button, 800 804 .customize-control-header button.new, 801 805 .customize-control-header button.remove { 802 806 white-space: normal; … … 808 812 .customize-control-upload .current .container, 809 813 .customize-control-image .current .container, 810 814 .customize-control-background .current .container, 815 .customize-control-cropimage .current .container, 811 816 .customize-control-header .current .container { 812 817 overflow: hidden; 813 818 -webkit-border-radius: 2px; … … 819 824 .customize-control-media .current .container, 820 825 .customize-control-upload .current .container, 821 826 .customize-control-background .current .container, 827 .customize-control-cropimage .current .container, 822 828 .customize-control-image .current .container { 823 829 min-height: 40px; 824 830 } … … 827 833 .customize-control-upload .placeholder, 828 834 .customize-control-image .placeholder, 829 835 .customize-control-background .placeholder, 836 .customize-control-cropimage .placeholder, 830 837 .customize-control-header .placeholder { 831 838 width: 100%; 832 839 position: relative; … … 838 845 .customize-control-upload .inner, 839 846 .customize-control-image .inner, 840 847 .customize-control-background .inner, 848 .customize-control-cropimage .inner, 841 849 .customize-control-header .inner { 842 850 display: none; 843 851 position: absolute; … … 851 859 .customize-control-media .inner, 852 860 .customize-control-upload .inner, 853 861 .customize-control-background .inner, 862 .customize-control-cropimage .inner, 854 863 .customize-control-image .inner { 855 864 display: block; 856 865 min-height: 40px; … … 860 869 .customize-control-upload .inner, 861 870 .customize-control-image .inner, 862 871 .customize-control-background .inner, 872 .customize-control-cropimage .inner, 863 873 .customize-control-header .inner, 864 874 .customize-control-header .inner .dashicons { 865 875 line-height: 20px; … … 963 973 .customize-control-upload .actions, 964 974 .customize-control-image .actions, 965 975 .customize-control-background .actions, 976 .customize-control-cropimage .actions, 966 977 .customize-control-header .actions { 967 978 margin-bottom: 32px; 968 979 } … … 981 992 .customize-control-upload img, 982 993 .customize-control-image img, 983 994 .customize-control-background img, 995 .customize-control-cropimage img, 984 996 .customize-control-header img { 985 997 width: 100%; 986 998 -webkit-border-radius: 2px; … … 995 1007 .customize-control-image .default-button, 996 1008 .customize-control-background .remove-button, 997 1009 .customize-control-background .default-button, 1010 .customize-control-cropimage .remove-button, 1011 .customize-control-cropimage .default-button, 998 1012 .customize-control-header .remove { 999 1013 float: left; 1000 1014 margin-right: 3px; … … 1004 1018 .customize-control-upload .upload-button, 1005 1019 .customize-control-image .upload-button, 1006 1020 .customize-control-background .upload-button, 1021 .customize-control-cropimage .upload-button, 1007 1022 .customize-control-header .new { 1008 1023 float: right; 1009 1024 } -
src/wp-admin/js/customize-controls.js
1840 1840 * @augments wp.customize.Control 1841 1841 * @augments wp.customize.Class 1842 1842 */ 1843 api.HeaderControl = api.Control.extend({ 1843 api.CropControl = api.UploadControl.extend({ 1844 /** 1845 * When the control's DOM structure is ready, 1846 * set up internal event bindings. 1847 */ 1844 1848 ready: function() { 1845 this.btnRemove = $('#customize-control-header_image .actions .remove'); 1846 this.btnNew = $('#customize-control-header_image .actions .new'); 1849 var control = this; 1847 1850 1848 _.bindAll(this, 'openMedia', 'removeImage'); 1851 api.UploadControl.prototype.ready.apply( this, arguments ); 1852 }, 1849 1853 1850 this.btnNew.on( 'click', this.openMedia ); 1851 this.btnRemove.on( 'click', this.removeImage ); 1854 /** 1855 * Open the media modal. 1856 */ 1857 openFrame: function( event ) { 1858 if ( api.utils.isKeydownButNotEnterEvent( event ) ) { 1859 return; 1860 } 1852 1861 1853 api.HeaderTool.currentHeader = this.getInitialHeaderImage(); 1862 if ( this.frame ) { 1863 this.frame.setState('library'); 1864 } 1854 1865 1855 new api.HeaderTool.CurrentView({ 1856 model: api.HeaderTool.currentHeader, 1857 el: '#customize-control-header_image .current .container' 1858 }); 1866 api.UploadControl.prototype.openFrame.call( this, event ); 1867 }, 1859 1868 1860 new api.HeaderTool.ChoiceListView({ 1861 collection: api.HeaderTool.UploadsList = new api.HeaderTool.ChoiceList(), 1862 el: '#customize-control-header_image .choices .uploaded .list' 1863 }); 1869 /** 1870 * Create a media modal select frame, and store it so the instance can be reused when needed. 1871 */ 1872 initFrame: function() { 1873 var l10n = _wpMediaViewsL10n; 1864 1874 1865 new api.HeaderTool.ChoiceListView({ 1866 collection: api.HeaderTool.DefaultsList = new api.HeaderTool.DefaultsList(), 1867 el: '#customize-control-header_image .choices .default .list' 1875 this.frame = wp.media({ 1876 button: { 1877 text: l10n.selectAndCrop, 1878 close: false 1879 }, 1880 states: [ 1881 new wp.media.controller.Library({ 1882 title: this.params.button_labels.frame_title, 1883 library: wp.media.query({ type: 'image' }), 1884 multiple: false, 1885 date: false, 1886 priority: 20, 1887 suggestedWidth: this.params.width, 1888 suggestedHeight: this.params.height 1889 }), 1890 new wp.media.controller.Cropper({ 1891 imgSelectOptions: this.calculateImageSelectOptions, 1892 control: this 1893 }) 1894 ] 1868 1895 }); 1869 1896 1870 api.HeaderTool.combinedList = api.HeaderTool.CombinedList = new api.HeaderTool.CombinedList([ 1871 api.HeaderTool.UploadsList, 1872 api.HeaderTool.DefaultsList 1873 ]); 1897 this.frame.on('select', this.select, this); 1898 this.frame.on('cropped', this.onCropped, this); 1899 this.frame.on('skippedcrop', this.onSkippedCrop, this); 1874 1900 }, 1875 1901 1876 1902 /** 1877 * Returns a new instance of api.HeaderTool.ImageModel based on the currently 1878 * saved header image (if any). 1903 * After an image is selected in the media modal, 1904 * switch to the cropper state. 1905 */ 1906 select: function() { 1907 this.frame.setState('cropper'); 1908 }, 1909 1910 /** 1911 * After the image has been cropped, apply the cropped image data to the setting. 1879 1912 * 1880 * @since 4.2.0 1881 * 1882 * @returns {Object} Options 1913 * @param {object} croppedImage Cropped attachment data. 1883 1914 */ 1884 getInitialHeaderImage: function() { 1885 if ( ! api.get().header_image || ! api.get().header_image_data || _.contains( [ 'remove-header', 'random-default-image', 'random-uploaded-image' ], api.get().header_image ) ) { 1886 return new api.HeaderTool.ImageModel(); 1887 } 1888 1889 // Get the matching uploaded image object. 1890 var currentHeaderObject = _.find( _wpCustomizeHeader.uploads, function( imageObj ) { 1891 return ( imageObj.attachment_id === api.get().header_image_data.attachment_id ); 1892 } ); 1893 // Fall back to raw current header image. 1894 if ( ! currentHeaderObject ) { 1895 currentHeaderObject = { 1896 url: api.get().header_image, 1897 thumbnail_url: api.get().header_image, 1898 attachment_id: api.get().header_image_data.attachment_id 1899 }; 1900 } 1901 1902 return new api.HeaderTool.ImageModel({ 1903 header: currentHeaderObject, 1904 choice: currentHeaderObject.url.split( '/' ).pop() 1905 }); 1915 onCropped: function(croppedImage) { 1916 var url = croppedImage.post_content, 1917 attachmentId = croppedImage.attachment_id, 1918 w = croppedImage.width, 1919 h = croppedImage.height; 1920 this.setImageFromURL(url, attachmentId, w, h); 1906 1921 }, 1907 1922 1908 1923 /** … … 1915 1930 * @returns {Object} Options 1916 1931 */ 1917 1932 calculateImageSelectOptions: function(attachment, controller) { 1918 var xInit = parseInt(_wpCustomizeHeader.data.width, 10), 1919 yInit = parseInt(_wpCustomizeHeader.data.height, 10), 1920 flexWidth = !! parseInt(_wpCustomizeHeader.data['flex-width'], 10), 1921 flexHeight = !! parseInt(_wpCustomizeHeader.data['flex-height'], 10), 1933 var control = controller.get('control'); 1934 var xInit = parseInt(control.params.width, 10), 1935 yInit = parseInt(control.params.height, 10), 1936 flexWidth = !! parseInt(control.params.flex_width, 10), 1937 flexHeight = !! parseInt(control.params.flex_height, 10), 1922 1938 ratio, xImg, yImg, realHeight, realWidth, 1923 1939 imgSelectOptions; 1924 1940 … … 1925 1941 realWidth = attachment.get('width'); 1926 1942 realHeight = attachment.get('height'); 1927 1943 1928 this. headerImage = new api.HeaderTool.ImageModel();1929 this. headerImage.set({1944 this.image = new api.CropTool.ImageModel(); 1945 this.image.set({ 1930 1946 themeWidth: xInit, 1931 1947 themeHeight: yInit, 1932 1948 themeFlexWidth: flexWidth, … … 1935 1951 imageHeight: realHeight 1936 1952 }); 1937 1953 1938 controller.set( 'canSkipCrop', ! this. headerImage.shouldBeCropped() );1954 controller.set( 'canSkipCrop', ! this.image.shouldBeCropped() ); 1939 1955 1940 1956 ratio = xInit / yInit; 1941 1957 xImg = realWidth; … … 1976 1992 }, 1977 1993 1978 1994 /** 1979 * Sets up and opens the Media Manager in order to select an image.1980 * Depending on both the size of the image and the properties of the1981 * current theme, a cropping step after selection may be required or1982 * skippable.1983 *1984 * @param {event} event1985 */1986 openMedia: function(event) {1987 var l10n = _wpMediaViewsL10n;1988 1989 event.preventDefault();1990 1991 this.frame = wp.media({1992 button: {1993 text: l10n.selectAndCrop,1994 close: false1995 },1996 states: [1997 new wp.media.controller.Library({1998 title: l10n.chooseImage,1999 library: wp.media.query({ type: 'image' }),2000 multiple: false,2001 date: false,2002 priority: 20,2003 suggestedWidth: _wpCustomizeHeader.data.width,2004 suggestedHeight: _wpCustomizeHeader.data.height2005 }),2006 new wp.media.controller.Cropper({2007 imgSelectOptions: this.calculateImageSelectOptions2008 })2009 ]2010 });2011 2012 this.frame.on('select', this.onSelect, this);2013 this.frame.on('cropped', this.onCropped, this);2014 this.frame.on('skippedcrop', this.onSkippedCrop, this);2015 2016 this.frame.open();2017 },2018 2019 /**2020 * After an image is selected in the media modal,2021 * switch to the cropper state.2022 */2023 onSelect: function() {2024 this.frame.setState('cropper');2025 },2026 2027 /**2028 * After the image has been cropped, apply the cropped image data to the setting.2029 *2030 * @param {object} croppedImage Cropped attachment data.2031 */2032 onCropped: function(croppedImage) {2033 var url = croppedImage.post_content,2034 attachmentId = croppedImage.attachment_id,2035 w = croppedImage.width,2036 h = croppedImage.height;2037 this.setImageFromURL(url, attachmentId, w, h);2038 },2039 2040 /**2041 1995 * If cropping was skipped, apply the image data directly to the setting. 2042 1996 * 2043 1997 * @param {object} selection … … 2088 2042 choice.importImage(); 2089 2043 }, 2090 2044 2091 /** 2092 * Triggers the necessary events to deselect an image which was set as 2093 * the currently selected one. 2094 */ 2095 removeImage: function() { 2096 api.HeaderTool.currentHeader.trigger('hide'); 2097 api.HeaderTool.CombinedList.trigger('control:removeImage'); 2098 } 2045 }); 2099 2046 2047 /** 2048 * @class 2049 * @augments wp.customize.Control 2050 * @augments wp.customize.Class 2051 */ 2052 api.HeaderControl = api.CropControl.extend({ 2053 2100 2054 }); 2101 2055 2102 2056 /** … … 2699 2653 media: api.MediaControl, 2700 2654 upload: api.UploadControl, 2701 2655 image: api.ImageControl, 2656 cropimage: api.CropControl, 2702 2657 header: api.HeaderControl, 2703 2658 background: api.BackgroundControl, 2704 2659 theme: api.ThemeControl -
src/wp-includes/class-wp-customize-control.php
997 997 } 998 998 999 999 /** 1000 * Customize HeaderImage Control class.1000 * Customize Cropped Image Control class. 1001 1001 * 1002 * @since 3.4.01002 * @since 4.3.0 1003 1003 * 1004 1004 * @see WP_Customize_Image_Control 1005 1005 */ 1006 class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control { 1007 public $type = 'header'; 1008 public $uploaded_headers; 1009 public $default_headers; 1006 class WP_Customize_Cropped_Image_Control extends WP_Customize_Image_Control { 1007 public $type = 'cropimage'; 1010 1008 1009 protected $width = 150; 1010 protected $height = 150; 1011 protected $flex_width = false; 1012 protected $flex_height = false; 1013 protected $localized_name; 1014 protected $current_title = ''; 1015 1011 1016 /** 1017 * Constructor. 1018 * 1019 * @since 4.3.0 1020 * @uses WP_Customize_Image_Control::__construct() 1021 * 1012 1022 * @param WP_Customize_Manager $manager 1013 1023 */ 1014 public function __construct( $manager ) { 1015 parent::__construct( $manager, 'header_image', array( 1016 'label' => __( 'Header Image' ), 1017 'settings' => array( 1018 'default' => 'header_image', 1019 'data' => 'header_image_data', 1020 ), 1021 'section' => 'header_image', 1022 'removed' => 'remove-header', 1023 'get_url' => 'get_header_image', 1024 ) ); 1025 1024 public function __construct( $manager, $id, $args ) { 1025 parent::__construct( $manager, $id, $args ); 1026 1026 } 1027 1027 1028 1028 /** … … 1029 1029 * @access public 1030 1030 */ 1031 1031 public function enqueue() { 1032 wp_enqueue_media();1033 1032 wp_enqueue_script( 'customize-views' ); 1034 1033 1035 $this->prepare_control(); 1034 parent::enqueue(); 1035 } 1036 1036 1037 wp_localize_script( 'customize-views', '_wpCustomizeHeader', array( 1038 'data' => array( 1039 'width' => absint( get_theme_support( 'custom-header', 'width' ) ), 1040 'height' => absint( get_theme_support( 'custom-header', 'height' ) ), 1041 'flex-width' => absint( get_theme_support( 'custom-header', 'flex-width' ) ), 1042 'flex-height' => absint( get_theme_support( 'custom-header', 'flex-height' ) ), 1043 'currentImgSrc' => $this->get_current_image_src(), 1037 /** 1038 * Refresh the parameters passed to the JavaScript via JSON. 1039 * 1040 * @since 4.3.0 1041 * @access public 1042 * @uses WP_Customize_Image_Control::to_json() 1043 * 1044 * @see WP_Customize_Control::to_json() 1045 */ 1046 public function to_json() { 1047 parent::to_json(); 1048 1049 $this->json['width'] = absint( $this->width ); 1050 $this->json['height'] = absint( $this->height ); 1051 $this->json['flex_width'] = absint( $this->flex_width ); 1052 $this->json['flex_height'] = absint( $this->flex_height ); 1053 } 1054 1055 } 1056 1057 /** 1058 * Customize Header Image Control class. 1059 * 1060 * @since 3.4.0 1061 * 1062 * @see WP_Customize_Cropped_Image_Control 1063 */ 1064 class WP_Customize_Header_Image_Control extends WP_Customize_Cropped_Image_Control { 1065 public $type = 'header'; 1066 1067 /** 1068 * @param WP_Customize_Manager $manager 1069 */ 1070 public function __construct( $manager ) { 1071 parent::__construct( $manager, 'header_image', array( 1072 'label' => __( 'Header Image' ), 1073 'current_title' => __( 'Current header' ), 1074 'settings' => array( 1075 'default' => 'header_image', 1076 'data' => 'header_image_data', 1044 1077 ), 1045 'nonces' => array( 1046 'add' => wp_create_nonce( 'header-add' ), 1047 'remove' => wp_create_nonce( 'header-remove' ), 1048 ), 1049 'uploads' => $this->uploaded_headers, 1050 'defaults' => $this->default_headers 1078 'section' => 'header_image', 1079 'removed' => 'remove-header', 1051 1080 ) ); 1052 1081 1053 parent::enqueue(); 1082 $this->width = get_theme_support( 'custom-header', 'width' ); 1083 $this->height = get_theme_support( 'custom-header', 'height' ); 1084 $this->flex_width = get_theme_support( 'custom-header', 'flex-width' ); 1085 $this->flex_height = get_theme_support( 'custom-header', 'flex-height' ); 1086 $this->localized_name = '_wpCustomizeHeader'; 1054 1087 } 1055 1088 1056 1089 /** … … 1059 1092 */ 1060 1093 public function prepare_control() { 1061 1094 global $custom_image_header; 1095 1062 1096 if ( empty( $custom_image_header ) ) { 1063 1097 return; 1064 1098 } … … 1065 1099 1066 1100 // Process default headers and uploaded headers. 1067 1101 $custom_image_header->process_default_headers(); 1068 $this->default_ headers= $custom_image_header->get_default_header_images();1069 $this->uploaded_ headers = $custom_image_header->get_uploaded_header_images();1102 $this->default_images = $custom_image_header->get_default_header_images(); 1103 $this->uploaded_images = $custom_image_header->get_uploaded_header_images(); 1070 1104 } 1071 1105 1072 1106 /** … … 1100 1134 1101 1135 <# } #> 1102 1136 </script> 1103 1104 <script type="text/template" id="tmpl-header-current">1105 <# if (data.choice) { #>1106 <# if (data.random) { #>1107 1108 <div class="placeholder">1109 <div class="inner">1110 <span><span class="dashicons dashicons-randomize dice"></span>1111 <# if ( data.type === 'uploaded' ) { #>1112 <?php _e( 'Randomizing uploaded headers' ); ?>1113 <# } else if ( data.type === 'default' ) { #>1114 <?php _e( 'Randomizing suggested headers' ); ?>1115 <# } #>1116 </span>1117 </div>1118 </div>1119 1120 <# } else { #>1121 1122 <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" tabindex="0"/>1123 1124 <# } #>1125 <# } else { #>1126 1127 <div class="placeholder">1128 <div class="inner">1129 <span>1130 <?php _e( 'No image set' ); ?>1131 </span>1132 </div>1133 </div>1134 1135 <# } #>1136 </script>1137 1137 <?php 1138 1138 } 1139 1139 1140 1140 /** 1141 * @return string|void1142 */1143 public function get_current_image_src() {1144 $src = $this->value();1145 if ( isset( $this->get_url ) ) {1146 $src = call_user_func( $this->get_url, $src );1147 return $src;1148 }1149 }1150 1151 /**1152 1141 * @access public 1153 1142 */ 1154 1143 public function render_content() { 1155 1144 $this->print_header_image_template(); 1156 $visibility = $this->get_current_image_src() ? '' : ' style="display:none" ';1157 $width = absint( get_theme_support( 'custom-header', 'width' ) );1158 $height = absint( get_theme_support( 'custom-header', 'height' ) );1159 ?>1160 1145 1161 1162 <div class="customize-control-content"> 1163 <p class="customizer-section-intro"> 1164 <?php 1165 if ( $width && $height ) { 1166 printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header size of <strong>%s × %s</strong> pixels.' ), $width, $height ); 1167 } elseif ( $width ) { 1168 printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header width of <strong>%s</strong> pixels.' ), $width ); 1169 } else { 1170 printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header height of <strong>%s</strong> pixels.' ), $height ); 1171 } 1172 ?> 1173 </p> 1174 <div class="current"> 1175 <span class="customize-control-title"> 1176 <?php _e( 'Current header' ); ?> 1177 </span> 1178 <div class="container"> 1179 </div> 1180 </div> 1181 <div class="actions"> 1182 <?php /* translators: Hide as in hide header image via the Customizer */ ?> 1183 <button type="button"<?php echo $visibility ?> class="button remove"><?php _ex( 'Hide image', 'custom header' ); ?></button> 1184 <?php /* translators: New as in add new header image via the Customizer */ ?> 1185 <button type="button" class="button new"><?php _ex( 'Add new image', 'header image' ); ?></button> 1186 <div style="clear:both"></div> 1187 </div> 1188 <div class="choices"> 1189 <span class="customize-control-title header-previously-uploaded"> 1190 <?php _ex( 'Previously uploaded', 'custom headers' ); ?> 1191 </span> 1192 <div class="uploaded"> 1193 <div class="list"> 1194 </div> 1195 </div> 1196 <span class="customize-control-title header-default"> 1197 <?php _ex( 'Suggested', 'custom headers' ); ?> 1198 </span> 1199 <div class="default"> 1200 <div class="list"> 1201 </div> 1202 </div> 1203 </div> 1204 </div> 1205 <?php 1146 parent::render_content(); 1206 1147 } 1207 1148 } 1208 1149 -
src/wp-includes/class-wp-customize-manager.php
1278 1278 $this->register_control_type( 'WP_Customize_Upload_Control' ); 1279 1279 $this->register_control_type( 'WP_Customize_Image_Control' ); 1280 1280 $this->register_control_type( 'WP_Customize_Background_Image_Control' ); 1281 $this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); 1281 1282 $this->register_control_type( 'WP_Customize_Theme_Control' ); 1282 1283 1283 1284 /* Themes */ -
src/wp-includes/class-wp-customize-nav-menus.php
403 403 'description' => $description, 404 404 ) ); 405 405 406 // @todo if ( ! $menus ) : make a "default" menu 407 if ( $menus ) { 408 $choices = array( '0' => __( '— Select —' ) ); 409 foreach ( $menus as $menu ) { 410 $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '…' ); 411 } 406 $choices = array( '0' => __( '— Select —' ) ); 407 foreach ( $menus as $menu ) { 408 $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '…' ); 409 } 412 410 413 414 411 foreach ( $locations as $location => $description ) { 412 $setting_id = "nav_menu_locations[{$location}]"; 415 413 416 417 418 419 420 421 422 423 424 425 426 427 428 414 $setting = $this->manager->get_setting( $setting_id ); 415 if ( $setting ) { 416 $setting->transport = 'postMessage'; 417 remove_filter( "customize_sanitize_{$setting_id}", 'absint' ); 418 add_filter( "customize_sanitize_{$setting_id}", array( $this, 'intval_base10' ) ); 419 } else { 420 $this->manager->add_setting( $setting_id, array( 421 'sanitize_callback' => array( $this, 'intval_base10' ), 422 'theme_supports' => 'menus', 423 'type' => 'theme_mod', 424 'transport' => 'postMessage', 425 ) ); 426 } 429 427 430 $this->manager->add_control( new WP_Customize_Nav_Menu_Location_Control( $this->manager, $setting_id, array( 431 'label' => $description, 432 'location_id' => $location, 433 'section' => 'menu_locations', 434 'choices' => $choices, 435 ) ) ); 436 } 428 $this->manager->add_control( new WP_Customize_Nav_Menu_Location_Control( $this->manager, $setting_id, array( 429 'label' => $description, 430 'location_id' => $location, 431 'section' => 'menu_locations', 432 'choices' => $choices, 433 ) ) ); 437 434 } 438 435 439 436 // Register each menu as a Customizer section, and add each menu item to each menu. -
src/wp-includes/js/customize-models.js
1 1 /* globals _wpCustomizeHeader, _ */ 2 2 (function( $, wp ) { 3 3 var api = wp.customize; 4 api. HeaderTool = {};4 api.CropTool = api.HeaderTool = {}; 5 5 6 6 7 7 /** 8 * wp.customize. HeaderTool.ImageModel8 * wp.customize.CropTool.ImageModel 9 9 * 10 10 * A header image. This is where saves via the Customizer API are 11 11 * abstracted away, plus our own AJAX calls to add images to and remove … … 16 16 * @constructor 17 17 * @augments Backbone.Model 18 18 */ 19 api. HeaderTool.ImageModel = Backbone.Model.extend({19 api.CropTool.ImageModel = Backbone.Model.extend({ 20 20 defaults: function() { 21 21 return { 22 22 header: { … … 129 129 * @augments Backbone.Collection 130 130 */ 131 131 api.HeaderTool.ChoiceList = Backbone.Collection.extend({ 132 model: api. HeaderTool.ImageModel,132 model: api.CropTool.ImageModel, 133 133 134 134 // Ordered from most recently used to least 135 135 comparator: function(model) { -
src/wp-includes/js/customize-views.js
16 16 * @augments wp.Backbone.View 17 17 */ 18 18 api.HeaderTool.CurrentView = wp.Backbone.View.extend({ 19 template: wp.template(' header-current'),19 template: wp.template('cropped-current'), 20 20 21 21 initialize: function() { 22 22 this.listenTo(this.model, 'change', this.render); … … 86 86 * Represents a choosable header image, be it user-uploaded, 87 87 * theme-suggested or a special Randomize choice. 88 88 * 89 * Takes a wp.customize. HeaderTool.ImageModel.89 * Takes a wp.customize.CropTool.ImageModel. 90 90 * 91 91 * Manually changes model wp.customize.HeaderTool.currentHeader via the 92 92 * `select` method.