WP_Widget_Media_Gallery::render_control_template_scripts()
Render form template scripts.
Description Description
Source Source
File: wp-includes/widgets/class-wp-widget-media-gallery.php
public function render_control_template_scripts() { parent::render_control_template_scripts(); ?> <script type="text/html" id="tmpl-wp-media-widget-gallery-preview"> <# var describedById = 'describedBy-' + String( Math.random() ); #> <# var ids = _.filter( data.ids, function( id ) { return ( id in data.attachments ); } ); #> <# if ( ids.length ) { #> <div class="gallery media-widget-gallery-preview"> <# _.each( ids, function( id, index ) { #> <# var attachment = data.attachments[ id ]; #> <# if ( index < 6 ) { #> <dl class="gallery-item"> <dt class="gallery-icon"> <# if ( attachment.sizes.thumbnail ) { #> <img src="{{ attachment.sizes.thumbnail.url }}" width="{{ attachment.sizes.thumbnail.width }}" height="{{ attachment.sizes.thumbnail.height }}" alt="" /> <# } else { #> <img src="{{ attachment.url }}" alt="" /> <# } #> <# if ( index === 5 && ids.length > 6 ) { #> <div class="gallery-icon-placeholder"> <p class="gallery-icon-placeholder-text">+{{ ids.length - 5 }}</p> </div> <# } #> </dt> </dl> <# } #> <# } ); #> </div> <# } else { #> <div class="attachment-media-view"> <p class="placeholder"><?php echo esc_html( $this->l10n['no_media_selected'] ); ?></p> </div> <# } #> </script> <?php }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
4.9.0 | Introduced. |