Themes: Restore 'Live Preview' button for block themes.
Note that the `return` query parameter is not yet functional in the Site Editor. See [https://github.com/WordPress/gutenberg/issues/47934 Gutenberg#47934]. Follow-up to [52341], [52346], [52353], [52802]. Props ninomiho, mcsf, dhruval04, praful2111, mlaetitia1986. See #54578. Fixes #64159. Built from https://develop.svn.wordpress.org/trunk@61195 git-svn-id: http://core.svn.wordpress.org/trunk@60531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -121,14 +121,24 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
|
||||
|
||||
$install_actions = array();
|
||||
|
||||
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) && ! $theme_info->is_block_theme() ) {
|
||||
$customize_url = add_query_arg(
|
||||
array(
|
||||
'theme' => urlencode( $stylesheet ),
|
||||
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
|
||||
),
|
||||
admin_url( 'customize.php' )
|
||||
);
|
||||
if ( current_user_can( 'edit_theme_options' ) && ( $theme_info->is_block_theme() || current_user_can( 'customize' ) ) ) {
|
||||
if ( $theme_info->is_block_theme() ) {
|
||||
$customize_url = add_query_arg(
|
||||
array(
|
||||
'wp_theme_preview' => urlencode( $stylesheet ),
|
||||
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
|
||||
),
|
||||
admin_url( 'site-editor.php' )
|
||||
);
|
||||
} else {
|
||||
$customize_url = add_query_arg(
|
||||
array(
|
||||
'theme' => urlencode( $stylesheet ),
|
||||
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
|
||||
),
|
||||
admin_url( 'customize.php' )
|
||||
);
|
||||
}
|
||||
|
||||
$install_actions['preview'] = sprintf(
|
||||
'<a href="%s" class="hide-if-no-customize load-customize">' .
|
||||
|
||||
@@ -645,7 +645,7 @@ foreach ( $themes as $theme ) :
|
||||
><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
|
||||
|
||||
<?php
|
||||
if ( ! $theme['blockTheme'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
|
||||
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
|
||||
/* translators: %s: Theme name. */
|
||||
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
@@ -1034,15 +1034,13 @@ function wp_theme_auto_update_setting_template() {
|
||||
aria-label="<?php echo esc_attr( $aria_label ); ?>"
|
||||
><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
|
||||
|
||||
<# if ( ! data.blockTheme ) { #>
|
||||
<?php
|
||||
/* translators: %s: Theme name. */
|
||||
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
<a class="button button-primary hide-if-no-customize disabled"
|
||||
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
|
||||
><?php _e( 'Live Preview' ); ?></a>
|
||||
<# } #>
|
||||
<?php
|
||||
/* translators: %s: Theme name. */
|
||||
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
<a class="button button-primary hide-if-no-customize disabled"
|
||||
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
|
||||
><?php _e( 'Live Preview' ); ?></a>
|
||||
<# } #>
|
||||
<# } #>
|
||||
</div>
|
||||
@@ -1261,16 +1259,14 @@ function wp_theme_auto_update_setting_template() {
|
||||
|
||||
<div class="inactive-theme">
|
||||
<# if ( data.compatibleWP && data.compatiblePHP ) { #>
|
||||
<# if ( ! data.blockTheme ) { #>
|
||||
<?php
|
||||
/* translators: %s: Theme name. */
|
||||
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
<a class="button button-primary load-customize hide-if-no-customize"
|
||||
href="{{{ data.actions.customize }}}"
|
||||
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
|
||||
><?php _e( 'Live Preview' ); ?></a>
|
||||
<# } #>
|
||||
<?php
|
||||
/* translators: %s: Theme name. */
|
||||
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
<a class="button button-primary load-customize hide-if-no-customize"
|
||||
href="{{{ data.actions.customize }}}"
|
||||
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
|
||||
><?php _e( 'Live Preview' ); ?></a>
|
||||
|
||||
<# if ( data.actions.activate ) { #>
|
||||
<?php
|
||||
@@ -1283,15 +1279,13 @@ function wp_theme_auto_update_setting_template() {
|
||||
><?php _e( 'Activate' ); ?></a>
|
||||
<# } #>
|
||||
<# } else { #>
|
||||
<# if ( ! data.blockTheme ) { #>
|
||||
<?php
|
||||
/* translators: %s: Theme name. */
|
||||
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
<a class="button button-primary hide-if-no-customize disabled"
|
||||
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
|
||||
><?php _e( 'Live Preview' ); ?></a>
|
||||
<# } #>
|
||||
<?php
|
||||
/* translators: %s: Theme name. */
|
||||
$live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' );
|
||||
?>
|
||||
<a class="button button-primary hide-if-no-customize disabled"
|
||||
aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>"
|
||||
><?php _e( 'Live Preview' ); ?></a>
|
||||
|
||||
<# if ( data.actions.activate ) { #>
|
||||
<?php
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.9-beta4-61194';
|
||||
$wp_version = '6.9-beta4-61195';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user