2015-10-24 20:57:25 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Customize API: WP_Customize_Site_Icon_Control class
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Customize
|
|
|
|
* @since 4.4.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Customize Site Icon control class.
|
|
|
|
*
|
|
|
|
* Used only for custom functionality in JavaScript.
|
|
|
|
*
|
|
|
|
* @since 4.3.0
|
|
|
|
*
|
|
|
|
* @see WP_Customize_Cropped_Image_Control
|
|
|
|
*/
|
|
|
|
class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Control type.
|
|
|
|
*
|
|
|
|
* @since 4.3.0
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $type = 'site_icon';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* @since 4.3.0
|
|
|
|
*
|
2020-02-26 14:30:08 +01:00
|
|
|
* @see WP_Customize_Control::__construct()
|
|
|
|
*
|
2015-10-24 20:57:25 +02:00
|
|
|
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
|
|
|
|
* @param string $id Control ID.
|
|
|
|
* @param array $args Optional. Arguments to override class property defaults.
|
2020-02-25 17:21:07 +01:00
|
|
|
* See WP_Customize_Control::__construct() for information
|
2020-02-25 17:41:07 +01:00
|
|
|
* on accepted arguments. Default empty array.
|
2015-10-24 20:57:25 +02:00
|
|
|
*/
|
|
|
|
public function __construct( $manager, $id, $args = array() ) {
|
|
|
|
parent::__construct( $manager, $id, $args );
|
|
|
|
add_action( 'customize_controls_print_styles', 'wp_site_icon', 99 );
|
|
|
|
}
|
Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/
Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland.
See #33755.
Built from https://develop.svn.wordpress.org/trunk@36698
git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 23:10:26 +01:00
|
|
|
|
|
|
|
/**
|
2016-03-16 17:41:27 +01:00
|
|
|
* Renders a JS template for the content of the site icon control.
|
Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/
Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland.
See #33755.
Built from https://develop.svn.wordpress.org/trunk@36698
git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 23:10:26 +01:00
|
|
|
*
|
|
|
|
* @since 4.5.0
|
|
|
|
*/
|
|
|
|
public function content_template() {
|
|
|
|
?>
|
2019-03-05 18:49:52 +01:00
|
|
|
<# if ( data.label ) { #>
|
|
|
|
<span class="customize-control-title">{{ data.label }}</span>
|
|
|
|
<# } #>
|
Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/
Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland.
See #33755.
Built from https://develop.svn.wordpress.org/trunk@36698
git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 23:10:26 +01:00
|
|
|
|
2016-06-16 11:45:27 +02:00
|
|
|
<# if ( data.attachment && data.attachment.id ) { #>
|
2016-05-12 22:23:54 +02:00
|
|
|
<div class="attachment-media-view">
|
2016-06-16 11:45:27 +02:00
|
|
|
<# if ( data.attachment.sizes ) { #>
|
2024-08-24 00:47:16 +02:00
|
|
|
<style>
|
|
|
|
:root{
|
|
|
|
--site-icon-url: url( '{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}' );
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div class="site-icon-preview customizer">
|
|
|
|
<div class="direction-wrap">
|
|
|
|
<img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" class="app-icon-preview" alt="{{
|
|
|
|
data.attachment.alt ?
|
|
|
|
wp.i18n.sprintf(
|
|
|
|
<?php
|
|
|
|
/* translators: %s: The selected image alt text. */
|
|
|
|
echo wp_json_encode( __( 'App icon preview: Current image: %s' ) )
|
|
|
|
?>
|
|
|
|
,
|
|
|
|
data.attachment.alt
|
|
|
|
) :
|
|
|
|
wp.i18n.sprintf(
|
|
|
|
<?php
|
|
|
|
/* translators: %s: The selected image filename. */
|
|
|
|
echo wp_json_encode( __( 'App icon preview: The current image has no alternative text. The file name is: %s' ) );
|
|
|
|
?>
|
|
|
|
,
|
|
|
|
data.attachment.filename
|
|
|
|
)
|
|
|
|
}}" />
|
|
|
|
<div class="site-icon-preview-browser">
|
|
|
|
<svg role="img" aria-hidden="true" fill="none" xmlns="http://www.w3.org/2000/svg" class="browser-buttons"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 20a6 6 0 1 1 12 0 6 6 0 0 1-12 0Zm18 0a6 6 0 1 1 12 0 6 6 0 0 1-12 0Zm24-6a6 6 0 1 0 0 12 6 6 0 0 0 0-12Z" /></svg>
|
|
|
|
<div class="site-icon-preview-tab">
|
|
|
|
<img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" class="browser-icon-preview" alt="{{
|
|
|
|
data.attachment.alt ?
|
|
|
|
wp.i18n.sprintf(
|
|
|
|
<?php
|
|
|
|
/* translators: %s: The selected image alt text. */
|
|
|
|
echo wp_json_encode( __( 'Browser icon preview: Current image: %s' ) );
|
|
|
|
?>
|
|
|
|
,
|
|
|
|
data.attachment.alt
|
|
|
|
) :
|
|
|
|
wp.i18n.sprintf(
|
|
|
|
<?php
|
|
|
|
/* translators: %s: The selected image filename. */
|
|
|
|
echo wp_json_encode( __( 'Browser icon preview: The current image has no alternative text. The file name is: %s' ) );
|
|
|
|
?>
|
|
|
|
,
|
|
|
|
data.attachment.filename
|
|
|
|
)
|
|
|
|
}}" />
|
|
|
|
<div class="site-icon-preview-site-title" aria-hidden="true"><# print( '<?php echo esc_js( get_bloginfo( 'name' ) ); ?>' ) #></div>
|
|
|
|
<svg role="img" aria-hidden="true" fill="none" xmlns="http://www.w3.org/2000/svg" class="close-button">
|
|
|
|
<path d="M12 13.0607L15.7123 16.773L16.773 15.7123L13.0607 12L16.773 8.28772L15.7123 7.22706L12 10.9394L8.28771 7.22705L7.22705 8.28771L10.9394 12L7.22706 15.7123L8.28772 16.773L12 13.0607Z" />
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-06-16 11:45:27 +02:00
|
|
|
</div>
|
Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/
Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland.
See #33755.
Built from https://develop.svn.wordpress.org/trunk@36698
git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 23:10:26 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-06-16 11:45:27 +02:00
|
|
|
<# } #>
|
2016-05-12 22:23:54 +02:00
|
|
|
<div class="actions">
|
|
|
|
<# if ( data.canUpload ) { #>
|
|
|
|
<button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
|
2019-03-05 18:49:52 +01:00
|
|
|
<button type="button" class="button upload-button"><?php echo $this->button_labels['change']; ?></button>
|
2016-05-12 22:23:54 +02:00
|
|
|
<# } #>
|
|
|
|
</div>
|
Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/
Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland.
See #33755.
Built from https://develop.svn.wordpress.org/trunk@36698
git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 23:10:26 +01:00
|
|
|
</div>
|
|
|
|
<# } else { #>
|
2016-05-12 22:23:54 +02:00
|
|
|
<div class="attachment-media-view">
|
2019-03-05 18:49:52 +01:00
|
|
|
<# if ( data.canUpload ) { #>
|
|
|
|
<button type="button" class="upload-button button-add-media"><?php echo $this->button_labels['site_icon']; ?></button>
|
|
|
|
<# } #>
|
2016-05-12 22:23:54 +02:00
|
|
|
<div class="actions">
|
|
|
|
<# if ( data.defaultAttachment ) { #>
|
|
|
|
<button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
|
|
|
|
<# } #>
|
Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/
Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland.
See #33755.
Built from https://develop.svn.wordpress.org/trunk@36698
git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 23:10:26 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<# } #>
|
2024-08-24 00:47:16 +02:00
|
|
|
<# if ( data.description ) { #>
|
|
|
|
<span class="description customize-control-description">{{{ data.description }}}</span>
|
|
|
|
<# } #>
|
Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/
Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland.
See #33755.
Built from https://develop.svn.wordpress.org/trunk@36698
git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 23:10:26 +01:00
|
|
|
<?php
|
|
|
|
}
|
2015-10-24 20:57:25 +02:00
|
|
|
}
|