Media: Add size dropdown to attachment display settings in the media modal. fixes #22206, see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
44314b715c
commit
76b23b3d48
|
@ -948,11 +948,11 @@
|
||||||
attachmentSettingsSidebar: function( options ) {
|
attachmentSettingsSidebar: function( options ) {
|
||||||
var state = this.state(),
|
var state = this.state(),
|
||||||
display = state.get('details'),
|
display = state.get('details'),
|
||||||
single = state.get('selection').single().cid;
|
single = state.get('selection').single();
|
||||||
|
|
||||||
this.settingsSidebar({ silent: true });
|
this.settingsSidebar({ silent: true });
|
||||||
|
|
||||||
display[ single ] = display[ single ] || new Backbone.Model({
|
display[ single.cid ] = display[ single.cid ] || new Backbone.Model({
|
||||||
align: getUserSetting( 'align', 'none' ),
|
align: getUserSetting( 'align', 'none' ),
|
||||||
size: getUserSetting( 'imgsize', 'medium' ),
|
size: getUserSetting( 'imgsize', 'medium' ),
|
||||||
link: getUserSetting( 'urlbutton', 'post' )
|
link: getUserSetting( 'urlbutton', 'post' )
|
||||||
|
@ -961,7 +961,8 @@
|
||||||
this.sidebar.view().add({
|
this.sidebar.view().add({
|
||||||
display: new media.view.Settings.AttachmentDisplay({
|
display: new media.view.Settings.AttachmentDisplay({
|
||||||
controller: this,
|
controller: this,
|
||||||
model: display[ single ],
|
model: display[ single.cid ],
|
||||||
|
sizes: single.get('sizes'),
|
||||||
priority: 100,
|
priority: 100,
|
||||||
userSettings: state.get('displayUserSettings')
|
userSettings: state.get('displayUserSettings')
|
||||||
}).render()
|
}).render()
|
||||||
|
|
|
@ -1471,6 +1471,35 @@ function wp_print_media_templates( $attachment ) {
|
||||||
<?php esc_attr_e('None'); ?>
|
<?php esc_attr_e('None'); ?>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( sizes ) ) { #>
|
||||||
|
<h4><?php _e('Size'); ?></h4>
|
||||||
|
<select class="size" name="size"
|
||||||
|
data-setting="size"
|
||||||
|
<# if ( userSettings ) { #>
|
||||||
|
data-user-setting="imgsize"
|
||||||
|
<# } #>>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sizes = apply_filters( 'image_size_names_choose', array(
|
||||||
|
'thumbnail' => __('Thumbnail'),
|
||||||
|
'medium' => __('Medium'),
|
||||||
|
'large' => __('Large'),
|
||||||
|
) );
|
||||||
|
|
||||||
|
foreach ( $sizes as $value => $name ) : ?>
|
||||||
|
<# if ( ! _.isUndefined( sizes['<?php echo esc_js( $value ); ?>'] ) ) { #>
|
||||||
|
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'medium' ); ?>>
|
||||||
|
<?php echo esc_html( $name ); ?>
|
||||||
|
</option>
|
||||||
|
<# } #>>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
<option value="full">
|
||||||
|
<?php echo esc_html_e( 'Full Size' ); ?>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<# } #>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="tmpl-gallery-settings">
|
<script type="text/html" id="tmpl-gallery-settings">
|
||||||
|
|
Loading…
Reference in New Issue