Make WordPress Core

Ticket #29211: 29211.diff

File 29211.diff, 21.7 KB (added by markoheijnen, 10 years ago)

Example PHP side

  • src/wp-admin/js/customize-controls.js

     
    18501850                        this.btnNew.on( 'click', this.openMedia );
    18511851                        this.btnRemove.on( 'click', this.removeImage );
    18521852
    1853                         api.HeaderTool.currentHeader = this.getInitialHeaderImage();
     1853                        api.ImageCrop.currentHeader = this.getInitialHeaderImage();
    18541854
    1855                         new api.HeaderTool.CurrentView({
    1856                                 model: api.HeaderTool.currentHeader,
     1855                        new api.ImageCrop.CurrentView({
     1856                                model: api.ImageCrop.currentHeader,
    18571857                                el: '#customize-control-header_image .current .container'
    18581858                        });
    18591859
    1860                         new api.HeaderTool.ChoiceListView({
    1861                                 collection: api.HeaderTool.UploadsList = new api.HeaderTool.ChoiceList(),
     1860                        new api.ImageCrop.ChoiceListView({
     1861                                collection: api.ImageCrop.UploadsList = new api.ImageCrop.ChoiceList(),
    18621862                                el: '#customize-control-header_image .choices .uploaded .list'
    18631863                        });
    18641864
    1865                         new api.HeaderTool.ChoiceListView({
    1866                                 collection: api.HeaderTool.DefaultsList = new api.HeaderTool.DefaultsList(),
     1865                        new api.ImageCrop.ChoiceListView({
     1866                                collection: api.ImageCrop.DefaultsList = new api.ImageCrop.DefaultsList(),
    18671867                                el: '#customize-control-header_image .choices .default .list'
    18681868                        });
    18691869
    1870                         api.HeaderTool.combinedList = api.HeaderTool.CombinedList = new api.HeaderTool.CombinedList([
    1871                                 api.HeaderTool.UploadsList,
    1872                                 api.HeaderTool.DefaultsList
     1870                        api.ImageCrop.combinedList = api.ImageCrop.CombinedList = new api.ImageCrop.CombinedList([
     1871                                api.ImageCrop.UploadsList,
     1872                                api.ImageCrop.DefaultsList
    18731873                        ]);
    18741874                },
    18751875
    18761876                /**
    1877                  * Returns a new instance of api.HeaderTool.ImageModel based on the currently
     1877                 * Returns a new instance of api.ImageCrop.ImageModel based on the currently
    18781878                 * saved header image (if any).
    18791879                 *
    18801880                 * @since 4.2.0
     
    18831883                 */
    18841884                getInitialHeaderImage: function() {
    18851885                        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();
     1886                                return new api.ImageCrop.ImageModel();
    18871887                        }
    18881888
    18891889                        // Get the matching uploaded image object.
     
    18991899                                };
    19001900                        }
    19011901
    1902                         return new api.HeaderTool.ImageModel({
     1902                        return new api.ImageCrop.ImageModel({
    19031903                                header: currentHeaderObject,
    19041904                                choice: currentHeaderObject.url.split( '/' ).pop()
    19051905                        });
     
    19251925                        realWidth = attachment.get('width');
    19261926                        realHeight = attachment.get('height');
    19271927
    1928                         this.headerImage = new api.HeaderTool.ImageModel();
     1928                        this.headerImage = new api.ImageCrop.ImageModel();
    19291929                        this.headerImage.set({
    19301930                                themeWidth: xInit,
    19311931                                themeHeight: yInit,
     
    20502050                },
    20512051
    20522052                /**
    2053                  * Creates a new wp.customize.HeaderTool.ImageModel from provided
     2053                 * Creates a new wp.customize.ImageCrop.ImageModel from provided
    20542054                 * header image data and inserts it into the user-uploaded headers
    20552055                 * collection.
    20562056                 *
     
    20782078                                data.height = height;
    20792079                        }
    20802080
    2081                         choice = new api.HeaderTool.ImageModel({
     2081                        choice = new api.ImageCrop.ImageModel({
    20822082                                header: data,
    20832083                                choice: url.split('/').pop()
    20842084                        });
    2085                         api.HeaderTool.UploadsList.add(choice);
    2086                         api.HeaderTool.currentHeader.set(choice.toJSON());
     2085                        api.ImageCrop.UploadsList.add(choice);
     2086                        api.ImageCrop.currentHeader.set(choice.toJSON());
    20872087                        choice.save();
    20882088                        choice.importImage();
    20892089                },
     
    20932093                 * the currently selected one.
    20942094                 */
    20952095                removeImage: function() {
    2096                         api.HeaderTool.currentHeader.trigger('hide');
    2097                         api.HeaderTool.CombinedList.trigger('control:removeImage');
     2096                        api.ImageCrop.currentHeader.trigger('hide');
     2097                        api.ImageCrop.CombinedList.trigger('control:removeImage');
    20982098                }
    20992099
    21002100        });
  • src/wp-includes/class-wp-customize-control.php

     
    997997}
    998998
    999999/**
    1000  * Customize Header Image Control class.
     1000 * Customize Cropped Image Control class.
    10011001 *
    1002  * @since 3.4.0
     1002 * @since 4.3.0
    10031003 *
    10041004 * @see WP_Customize_Image_Control
    10051005 */
    1006 class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
    1007         public $type = 'header';
    1008         public $uploaded_headers;
    1009         public $default_headers;
     1006class WP_Customize_Cropped_Image_Control extends WP_Customize_Image_Control {
     1007        public $type = 'cropped-image';
    10101008
    1011         /**
    1012          * @param WP_Customize_Manager $manager
    1013          */
    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                 ) );
     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 = '';
    10251015
    1026         }
     1016        protected $uploaded_images = array();
     1017        protected $default_images  = array();
    10271018
    10281019        /**
    10291020         * @access public
     
    10341025
    10351026                $this->prepare_control();
    10361027
    1037                 wp_localize_script( 'customize-views', '_wpCustomizeHeader', array(
     1028                wp_localize_script( 'customize-views', $this->localized_name, array(
    10381029                        '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(),
     1030                                'width' => absint( $this->width ),
     1031                                'height' => absint( $this->height ),
     1032                                'flex-width' => absint( $this->flex_width ),
     1033                                'flex-height' => absint( $this->flex_height ),
    10441034                        ),
    10451035                        'nonces' => array(
    10461036                                'add' => wp_create_nonce( 'header-add' ),
    10471037                                'remove' => wp_create_nonce( 'header-remove' ),
    10481038                        ),
    1049                         'uploads' => $this->uploaded_headers,
    1050                         'defaults' => $this->default_headers
     1039                        'uploads'  => $this->uploaded_images,
     1040                        'defaults' => $this->default_images
    10511041                ) );
    10521042
    10531043                parent::enqueue();
     
    10541044        }
    10551045
    10561046        /**
    1057          *
    1058          * @global Custom_Image_Header $custom_image_header
    1059          */
    1060         public function prepare_control() {
    1061                 global $custom_image_header;
    1062                 if ( empty( $custom_image_header ) ) {
    1063                         return;
    1064                 }
    1065 
    1066                 // Process default headers and uploaded headers.
    1067                 $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();
    1070         }
    1071 
    1072         /**
    10731047         * @access public
    10741048         */
    1075         public function print_header_image_template() {
     1049        public function print_crop_image_template() {
    10761050                ?>
    1077                 <script type="text/template" id="tmpl-header-choice">
    1078                         <# if (data.random) { #>
    1079                         <button type="button" class="button display-options random">
    1080                                 <span class="dashicons dashicons-randomize dice"></span>
    1081                                 <# if ( data.type === 'uploaded' ) { #>
    1082                                         <?php _e( 'Randomize uploaded headers' ); ?>
    1083                                 <# } else if ( data.type === 'default' ) { #>
    1084                                         <?php _e( 'Randomize suggested headers' ); ?>
    1085                                 <# } #>
    1086                         </button>
    1087 
    1088                         <# } else { #>
    1089 
    1090                         <# if (data.type === 'uploaded') { #>
    1091                                 <button type="button" class="dashicons dashicons-no close"><span class="screen-reader-text"><?php _e( 'Remove image' ); ?></span></button>
    1092                         <# } #>
    1093 
    1094                         <button type="button" class="choice thumbnail"
    1095                                 data-customize-image-value="{{{data.header.url}}}"
    1096                                 data-customize-header-image-data="{{JSON.stringify(data.header)}}">
    1097                                 <span class="screen-reader-text"><?php _e( 'Set image' ); ?></span>
    1098                                 <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}">
    1099                         </button>
    1100 
    1101                         <# } #>
    1102                 </script>
    1103 
    1104                 <script type="text/template" id="tmpl-header-current">
     1051                <script type="text/template" id="tmpl-cropped-current">
    11051052                        <# if (data.choice) { #>
    11061053                                <# if (data.random) { #>
    11071054
     
    11381085        }
    11391086
    11401087        /**
    1141          * @return string|void
    1142          */
    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         /**
    11521088         * @access public
    11531089         */
    11541090        public function render_content() {
    1155                 $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' ) );
     1091                $this->print_crop_image_template();
     1092
     1093                $width = absint( $this->width );
     1094                $height = absint( $this->height );
    11591095                ?>
    11601096
    1161 
    11621097                <div class="customize-control-content">
    11631098                        <p class="customizer-section-intro">
    11641099                                <?php
    11651100                                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 &times; %s</strong> pixels.' ), $width, $height );
     1101                                        printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a size of <strong>%s &times; %s</strong> pixels.' ), $width, $height );
    11671102                                } 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 );
     1103                                        printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a width of <strong>%s</strong> pixels.' ), $width );
    11691104                                } 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 );
     1105                                        printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a height of <strong>%s</strong> pixels.' ), $height );
    11711106                                }
    11721107                                ?>
    11731108                        </p>
    11741109                        <div class="current">
    11751110                                <span class="customize-control-title">
    1176                                         <?php _e( 'Current header' ); ?>
     1111                                        <?php echo $this->current_title; ?>
    11771112                                </span>
    11781113                                <div class="container">
    11791114                                </div>
    11801115                        </div>
    11811116                        <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>
     1117                                <?php /* translators: Hide as in hide cropped image via the Customizer */ ?>
     1118                                <button type="button" class="button remove"><?php _ex( 'Hide image', 'crop image' ); ?></button>
     1119                                <?php /* translators: New as in add new cropped image via the Customizer */ ?>
     1120                                <button type="button" class="button new"><?php _ex( 'Add new image', 'cropped image' ); ?></button>
    11861121                                <div style="clear:both"></div>
    11871122                        </div>
    11881123                        <div class="choices">
    1189                                 <span class="customize-control-title header-previously-uploaded">
    1190                                         <?php _ex( 'Previously uploaded', 'custom headers' ); ?>
     1124                                <span class="customize-control-title cropped-image-previously-uploaded">
     1125                                        <?php _ex( 'Previously uploaded', 'cropped images' ); ?>
    11911126                                </span>
    11921127                                <div class="uploaded">
    11931128                                        <div class="list">
    11941129                                        </div>
    11951130                                </div>
    1196                                 <span class="customize-control-title header-default">
    1197                                         <?php _ex( 'Suggested', 'custom headers' ); ?>
     1131                                <span class="customize-control-title cropped-image-default">
     1132                                        <?php _ex( 'Suggested', 'cropped images' ); ?>
    11981133                                </span>
    11991134                                <div class="default">
    12001135                                        <div class="list">
     
    12071142}
    12081143
    12091144/**
     1145 * Customize Header Image Control class.
     1146 *
     1147 * @since 3.4.0
     1148 *
     1149 * @see WP_Customize_Cropped_Image_Control
     1150 */
     1151class WP_Customize_Header_Image_Control extends WP_Customize_Cropped_Image_Control {
     1152        public $type = 'header';
     1153
     1154        /**
     1155         * @param WP_Customize_Manager $manager
     1156         */
     1157        public function __construct( $manager ) {
     1158                parent::__construct( $manager, 'header_image', array(
     1159                        'label'    => __( 'Header Image' ),
     1160                        'settings' => array(
     1161                                'default' => 'header_image',
     1162                                'data'    => 'header_image_data',
     1163                        ),
     1164                        'section'       => 'header_image',
     1165                        'removed'       => 'remove-header',
     1166                        'get_url'       => 'get_header_image',
     1167                        'current_title' => __( 'Current header' ),
     1168                ) );
     1169
     1170                $this->width  = get_theme_support( 'custom-header', 'width' );
     1171                $this->height = get_theme_support( 'custom-header', 'height' );
     1172                $this->flex_width  = get_theme_support( 'custom-header', 'flex-width' );
     1173                $this->flex_height = get_theme_support( 'custom-header', 'flex-height' );
     1174                $this->localized_name = '_wpCustomizeHeader';
     1175        }
     1176
     1177        /**
     1178         *
     1179         * @global Custom_Image_Header $custom_image_header
     1180         */
     1181        public function prepare_control() {
     1182                global $custom_image_header;
     1183
     1184                if ( empty( $custom_image_header ) ) {
     1185                        return;
     1186                }
     1187
     1188                // Process default headers and uploaded headers.
     1189                $custom_image_header->process_default_headers();
     1190                $this->default_images  = $custom_image_header->get_default_header_images();
     1191                $this->uploaded_images = $custom_image_header->get_uploaded_header_images();
     1192        }
     1193
     1194        /**
     1195         * @access public
     1196         */
     1197        public function print_header_image_template() {
     1198                ?>
     1199                <script type="text/template" id="tmpl-header-choice">
     1200                        <# if (data.random) { #>
     1201                        <button type="button" class="button display-options random">
     1202                                <span class="dashicons dashicons-randomize dice"></span>
     1203                                <# if ( data.type === 'uploaded' ) { #>
     1204                                        <?php _e( 'Randomize uploaded headers' ); ?>
     1205                                <# } else if ( data.type === 'default' ) { #>
     1206                                        <?php _e( 'Randomize suggested headers' ); ?>
     1207                                <# } #>
     1208                        </button>
     1209
     1210                        <# } else { #>
     1211
     1212                        <# if (data.type === 'uploaded') { #>
     1213                                <button type="button" class="dashicons dashicons-no close"><span class="screen-reader-text"><?php _e( 'Remove image' ); ?></span></button>
     1214                        <# } #>
     1215
     1216                        <button type="button" class="choice thumbnail"
     1217                                data-customize-image-value="{{{data.header.url}}}"
     1218                                data-customize-header-image-data="{{JSON.stringify(data.header)}}">
     1219                                <span class="screen-reader-text"><?php _e( 'Set image' ); ?></span>
     1220                                <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}">
     1221                        </button>
     1222
     1223                        <# } #>
     1224                </script>
     1225                <?php
     1226        }
     1227
     1228        /**
     1229         * @access public
     1230         */
     1231        public function render_content() {
     1232                $this->print_header_image_template();
     1233
     1234                parent::render_content();
     1235        }
     1236}
     1237
     1238/**
    12101239 * Customize Theme Control class.
    12111240 *
    12121241 * @since 4.2.0
  • src/wp-includes/js/customize-models.js

     
    11/* globals _wpCustomizeHeader, _ */
    22(function( $, wp ) {
    33        var api = wp.customize;
    4         api.HeaderTool = {};
     4        api.ImageCrop = {};
    55
    66
    77        /**
    8          * wp.customize.HeaderTool.ImageModel
     8         * wp.customize.ImageCrop.ImageModel
    99         *
    1010         * A header image. This is where saves via the Customizer API are
    1111         * abstracted away, plus our own AJAX calls to add images to and remove
     
    1616         * @constructor
    1717         * @augments Backbone.Model
    1818         */
    19         api.HeaderTool.ImageModel = Backbone.Model.extend({
     19        api.ImageCrop.ImageModel = Backbone.Model.extend({
    2020                defaults: function() {
    2121                        return {
    2222                                header: {
     
    4343
    4444                destroy: function() {
    4545                        var data = this.get('header'),
    46                                 curr = api.HeaderTool.currentHeader.get('header').attachment_id;
     46                                curr = api.ImageCrop.currentHeader.get('header').attachment_id;
    4747
    4848                        // If the image we're removing is also the current header, unset
    4949                        // the latter
    5050                        if (curr && data.attachment_id === curr) {
    51                                 api.HeaderTool.currentHeader.trigger('hide');
     51                                api.ImageCrop.currentHeader.trigger('hide');
    5252                        }
    5353
    5454                        wp.ajax.post( 'custom-header-remove', {
     
    7575                                }
    7676                        }
    7777
    78                         api.HeaderTool.combinedList.trigger('control:setImage', this);
     78                        api.ImageCrop.combinedList.trigger('control:setImage', this);
    7979                },
    8080
    8181                importImage: function() {
     
    123123
    124124
    125125        /**
    126          * wp.customize.HeaderTool.ChoiceList
     126         * wp.customize.ImageCrop.ChoiceList
    127127         *
    128128         * @constructor
    129129         * @augments Backbone.Collection
    130130         */
    131         api.HeaderTool.ChoiceList = Backbone.Collection.extend({
    132                 model: api.HeaderTool.ImageModel,
     131        api.ImageCrop.ChoiceList = Backbone.Collection.extend({
     132                model: api.ImageCrop.ImageModel,
    133133
    134134                // Ordered from most recently used to least
    135135                comparator: function(model) {
     
    137137                },
    138138
    139139                initialize: function() {
    140                         var current = api.HeaderTool.currentHeader.get('choice').replace(/^https?:\/\//, ''),
     140                        var current = api.ImageCrop.currentHeader.get('choice').replace(/^https?:\/\//, ''),
    141141                                isRandom = this.isRandomChoice(api.get().header_image);
    142142
    143143                        // Overridable by an extending class
     
    230230
    231231
    232232        /**
    233          * wp.customize.HeaderTool.DefaultsList
     233         * wp.customize.ImageCrop.DefaultsList
    234234         *
    235235         * @constructor
    236          * @augments wp.customize.HeaderTool.ChoiceList
     236         * @augments wp.customize.ImageCrop.ChoiceList
    237237         * @augments Backbone.Collection
    238238         */
    239         api.HeaderTool.DefaultsList = api.HeaderTool.ChoiceList.extend({
     239        api.ImageCrop.DefaultsList = api.ImageCrop.ChoiceList.extend({
    240240                initialize: function() {
    241241                        this.type = 'default';
    242242                        this.data = _wpCustomizeHeader.defaults;
    243                         api.HeaderTool.ChoiceList.prototype.initialize.apply(this);
     243                        api.ImageCrop.ChoiceList.prototype.initialize.apply(this);
    244244                }
    245245        });
    246246
  • src/wp-includes/js/customize-views.js

     
    55
    66
    77        /**
    8          * wp.customize.HeaderTool.CurrentView
     8         * wp.customize.ImageCrop.CurrentView
    99         *
    10          * Displays the currently selected header image, or a placeholder in lack
     10         * Displays the currently selected image, or a placeholder in lack
    1111         * thereof.
    1212         *
    13          * Instantiate with model wp.customize.HeaderTool.currentHeader.
     13         * Instantiate with model wp.customize.ImageCrop.currentHeader.
    1414         *
    1515         * @constructor
    1616         * @augments wp.Backbone.View
    1717         */
    18         api.HeaderTool.CurrentView = wp.Backbone.View.extend({
    19                 template: wp.template('header-current'),
     18        api.ImageCrop.CurrentView = wp.Backbone.View.extend({
     19                template: wp.template('cropped-current'),
    2020
    2121                initialize: function() {
    2222                        this.listenTo(this.model, 'change', this.render);
     
    8181
    8282
    8383        /**
    84          * wp.customize.HeaderTool.ChoiceView
     84         * wp.customize.ImageCrop.ChoiceView
    8585         *
    8686         * Represents a choosable header image, be it user-uploaded,
    8787         * theme-suggested or a special Randomize choice.
    8888         *
    89          * Takes a wp.customize.HeaderTool.ImageModel.
     89         * Takes a wp.customize.ImageCrop.ImageModel.
    9090         *
    91          * Manually changes model wp.customize.HeaderTool.currentHeader via the
     91         * Manually changes model wp.customize.ImageCrop.currentHeader via the
    9292         * `select` method.
    9393         *
    9494         * @constructor
    9595         * @augments wp.Backbone.View
    9696         */
    97         api.HeaderTool.ChoiceView = wp.Backbone.View.extend({
     97        api.ImageCrop.ChoiceView = wp.Backbone.View.extend({
    9898                template: wp.template('header-choice'),
    9999
    100100                className: 'header-view',
     
    113113                        this.listenTo(this.model, 'change:selected', this.toggleSelected);
    114114
    115115                        if (_.contains(properties, api.get().header_image)) {
    116                                 api.HeaderTool.currentHeader.set(this.extendedModel());
     116                                api.ImageCrop.currentHeader.set(this.extendedModel());
    117117                        }
    118118                },
    119119
     
    135135                        });
    136136                },
    137137
    138                 getHeight: api.HeaderTool.CurrentView.prototype.getHeight,
     138                getHeight: api.ImageCrop.CurrentView.prototype.getHeight,
    139139
    140                 setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder,
     140                setPlaceholder: api.ImageCrop.CurrentView.prototype.setPlaceholder,
    141141
    142142                select: function() {
    143143                        this.preventJump();
    144144                        this.model.save();
    145                         api.HeaderTool.currentHeader.set(this.extendedModel());
     145                        api.ImageCrop.currentHeader.set(this.extendedModel());
    146146                },
    147147
    148148                preventJump: function() {
     
    163163
    164164
    165165        /**
    166          * wp.customize.HeaderTool.ChoiceListView
     166         * wp.customize.ImageCrop.ChoiceListView
    167167         *
    168168         * A container for ChoiceViews. These choices should be of one same type:
    169169         * user-uploaded headers or theme-defined ones.
    170170         *
    171          * Takes a wp.customize.HeaderTool.ChoiceList.
     171         * Takes a wp.customize.ImageCrop.ChoiceList.
    172172         *
    173173         * @constructor
    174174         * @augments wp.Backbone.View
    175175         */
    176         api.HeaderTool.ChoiceListView = wp.Backbone.View.extend({
     176        api.ImageCrop.ChoiceListView = wp.Backbone.View.extend({
    177177                initialize: function() {
    178178                        this.listenTo(this.collection, 'add', this.addOne);
    179179                        this.listenTo(this.collection, 'remove', this.render);
     
    191191                addOne: function(choice) {
    192192                        var view;
    193193                        choice.set({ collection: this.collection });
    194                         view = new api.HeaderTool.ChoiceView({ model: choice });
     194                        view = new api.ImageCrop.ChoiceView({ model: choice });
    195195                        this.$el.append(view.render().el);
    196196                },
    197197
     
    208208
    209209
    210210        /**
    211          * wp.customize.HeaderTool.CombinedList
     211         * wp.customize.ImageCrop.CombinedList
    212212         *
    213          * Aggregates wp.customize.HeaderTool.ChoiceList collections (or any
     213         * Aggregates wp.customize.ImageCrop.ChoiceList collections (or any
    214214         * Backbone object, really) and acts as a bus to feed them events.
    215215         *
    216216         * @constructor
    217217         * @augments wp.Backbone.View
    218218         */
    219         api.HeaderTool.CombinedList = wp.Backbone.View.extend({
     219        api.ImageCrop.CombinedList = wp.Backbone.View.extend({
    220220                initialize: function(collections) {
    221221                        this.collections = collections;
    222222                        this.on('all', this.propagate, this);