WP_Customize_Site_Icon_Control

Customize Site Icon control class.

Defined (1)

The class is defined in the following location(s).

/wp-includes/customize/class-wp-customize-site-icon-control.php  
  1. class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control { 
  2.  
  3. /** 
  4. * Control type. 
  5. * @since 4.3.0 
  6. * @access public 
  7. * @var string 
  8. */ 
  9. public $type = 'site_icon'; 
  10.  
  11. /** 
  12. * Constructor. 
  13. * @since 4.3.0 
  14. * @access public 
  15. * @param WP_Customize_Manager $manager Customizer bootstrap instance. 
  16. * @param string $id Control ID. 
  17. * @param array $args Optional. Arguments to override class property defaults. 
  18. */ 
  19. public function __construct( $manager, $id, $args = array() ) { 
  20. parent::__construct( $manager, $id, $args ); 
  21. add_action( 'customize_controls_print_styles', 'wp_site_icon', 99 ); 
  22.  
  23. /** 
  24. * Renders a JS template for the content of the site icon control. 
  25. * @since 4.5.0 
  26. * @access public 
  27. */ 
  28. public function content_template() { 
  29. ?> 
  30. <label for="{{ data.settings['default'] }}-button"> 
  31. <# if ( data.label ) { #> 
  32. <span class="customize-control-title">{{ data.label }}</span> 
  33. <# } #> 
  34. <# if ( data.description ) { #> 
  35. <span class="description customize-control-description">{{{ data.description }}}</span> 
  36. <# } #> 
  37. </label> 
  38.  
  39. <# if ( data.attachment && data.attachment.id ) { #> 
  40. <div class="attachment-media-view"> 
  41. <# if ( data.attachment.sizes ) { #> 
  42. <div class="site-icon-preview"> 
  43. <div class="favicon-preview"> 
  44. <img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" alt="" /> 
  45.  
  46. <div class="favicon"> 
  47. <img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/> 
  48. </div> 
  49. <span class="browser-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></span> 
  50. </div> 
  51. <img class="app-icon-preview" src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/> 
  52. </div> 
  53. <# } #> 
  54. <div class="actions"> 
  55. <# if ( data.canUpload ) { #> 
  56. <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button> 
  57. <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button> 
  58. <div style="clear:both"></div> 
  59. <# } #> 
  60. </div> 
  61. </div> 
  62. <# } else { #> 
  63. <div class="attachment-media-view"> 
  64. <div class="placeholder"> 
  65. <?php echo $this->button_labels['placeholder']; ?> 
  66. </div> 
  67. <div class="actions"> 
  68. <# if ( data.defaultAttachment ) { #> 
  69. <button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button> 
  70. <# } #> 
  71. <# if ( data.canUpload ) { #> 
  72. <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button> 
  73. <# } #> 
  74. <div style="clear:both"></div> 
  75. </div> 
  76. </div> 
  77. <# } #> 
  78. <?php