3 * Customize API: WP_Customize_Site_Icon_Control class
6 * @subpackage Customize
11 * Customize Site Icon control class.
13 * Used only for custom functionality in JavaScript.
17 * @see WP_Customize_Cropped_Image_Control
19 class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control {
28 public $type = 'site_icon';
36 * @param WP_Customize_Manager $manager Customizer bootstrap instance.
37 * @param string $id Control ID.
38 * @param array $args Optional. Arguments to override class property defaults.
40 public function __construct( $manager, $id, $args = array() ) {
41 parent::__construct( $manager, $id, $args );
42 add_action( 'customize_controls_print_styles', 'wp_site_icon', 99 );
46 * Renders a JS template for the content of the site icon control.
51 public function content_template() {
53 <label for="{{ data.settings['default'] }}-button">
54 <# if ( data.label ) { #>
55 <span class="customize-control-title">{{ data.label }}</span>
57 <# if ( data.description ) { #>
58 <span class="description customize-control-description">{{{ data.description }}}</span>
62 <# if ( data.attachment && data.attachment.id ) { #>
63 <div class="attachment-media-view">
64 <# if ( data.attachment.sizes ) { #>
65 <div class="site-icon-preview">
66 <div class="favicon-preview">
67 <img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" alt="" />
70 <img src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/>
72 <span class="browser-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></span>
74 <img class="app-icon-preview" src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/>
78 <# if ( data.canUpload ) { #>
79 <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
80 <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
81 <div style="clear:both"></div>
86 <div class="attachment-media-view">
87 <div class="placeholder">
88 <?php echo $this->button_labels['placeholder']; ?>
91 <# if ( data.defaultAttachment ) { #>
92 <button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
94 <# if ( data.canUpload ) { #>
95 <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
97 <div style="clear:both"></div>