Make WordPress Core

Changeset 36769


Ignore:
Timestamp:
02/29/2016 12:39:33 AM (9 years ago)
Author:
westonruter
Message:

Customize: Allow button_labels to be overridden in $args passed to WP_Customize_Media_Control and WP_Customize_Image_Control.

Props chetanchauhan, celloexpressions.
See #33755.
Fixes #35542.

Location:
trunk/src/wp-includes/customize
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-image-control.php

    r35389 r36769  
    3232        parent::__construct( $manager, $id, $args );
    3333
    34         $this->button_labels = array(
     34        $this->button_labels = wp_parse_args( $this->button_labels, array(
    3535            'select'       => __( 'Select Image' ),
    3636            'change'       => __( 'Change Image' ),
     
    4040            'frame_title'  => __( 'Select Image' ),
    4141            'frame_button' => __( 'Choose Image' ),
    42         );
     42        ) );
    4343    }
    4444
  • trunk/src/wp-includes/customize/class-wp-customize-media-control.php

    r35567 r36769  
    5656        parent::__construct( $manager, $id, $args );
    5757
    58         $this->button_labels = array(
    59             'select'       => __( 'Select File' ),
    60             'change'       => __( 'Change File' ),
    61             'default'      => __( 'Default' ),
    62             'remove'       => __( 'Remove' ),
    63             'placeholder'  => __( 'No file selected' ),
    64             'frame_title'  => __( 'Select File' ),
    65             'frame_button' => __( 'Choose File' ),
    66         );
     58        if ( ! ( $this instanceof WP_Customize_Image_Control ) ) {
     59            $this->button_labels = wp_parse_args( $this->button_labels, array(
     60                'select'       => __( 'Select File' ),
     61                'change'       => __( 'Change File' ),
     62                'default'      => __( 'Default' ),
     63                'remove'       => __( 'Remove' ),
     64                'placeholder'  => __( 'No file selected' ),
     65                'frame_title'  => __( 'Select File' ),
     66                'frame_button' => __( 'Choose File' ),
     67            ) );
     68        }
    6769    }
    6870
     
    194196            <div class="actions">
    195197                <# if ( data.canUpload ) { #>
    196                 <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
    197                 <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
     198                <button type="button" class="button remove-button">{{ data.button_labels.remove }}</button>
     199                <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button">{{ data.button_labels.change }}</button>
    198200                <div style="clear:both"></div>
    199201                <# } #>
     
    205207                        <div class="inner">
    206208                            <span>
    207                                 <?php echo $this->button_labels['placeholder']; ?>
     209                                {{ data.button_labels.placeholder }}
    208210                            </span>
    209211                        </div>
     
    213215            <div class="actions">
    214216                <# if ( data.defaultAttachment ) { #>
    215                     <button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
     217                    <button type="button" class="button default-button">{{ data.button_labels.default }}</button>
    216218                <# } #>
    217219                <# if ( data.canUpload ) { #>
    218                 <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
     220                <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button">{{ data.button_labels.select }}</button>
    219221                <# } #>
    220222                <div style="clear:both"></div>
Note: See TracChangeset for help on using the changeset viewer.