[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-includes/customize/ -> class-wp-customize-site-icon-control.php (source)

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


Generated: Wed Oct 16 08:20:01 2019 Cross-referenced by PHPXref 0.7