Customize: Fix logic inversion in [42113] which prevented themes from being installed in Customizer.

Also fix PHP notice related to parent themes and WordPress.org theme query results.

Props dd32, obenland, celloexpressions, westonruter, atachibana for testing.
See #42406, #37661.
Fixes #42442.

Built from https://develop.svn.wordpress.org/trunk@42122


git-svn-id: http://core.svn.wordpress.org/trunk@41953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-11-07 04:17:47 +00:00
parent 2382232692
commit e4fe01e2b4
4 changed files with 15 additions and 7 deletions

View File

@ -3202,7 +3202,7 @@
} }
// Prevent loading a non-active theme preview when there is a drafted/scheduled changeset. // Prevent loading a non-active theme preview when there is a drafted/scheduled changeset.
if ( panel.canSwitchTheme( slug ) ) { if ( ! panel.canSwitchTheme( slug ) ) {
deferred.reject({ deferred.reject({
errorCode: 'theme_switch_unavailable' errorCode: 'theme_switch_unavailable'
}); });
@ -3299,7 +3299,10 @@
// Prevent loading a non-active theme preview when there is a drafted/scheduled changeset. // Prevent loading a non-active theme preview when there is a drafted/scheduled changeset.
if ( ! panel.canSwitchTheme( themeId ) ) { if ( ! panel.canSwitchTheme( themeId ) ) {
return deferred.reject().promise(); deferred.reject({
errorCode: 'theme_switch_unavailable'
});
return deferred.promise();
} }
urlParser = document.createElement( 'a' ); urlParser = document.createElement( 'a' );

File diff suppressed because one or more lines are too long

View File

@ -5446,7 +5446,12 @@ final class WP_Customize_Manager {
$theme->id = $theme->slug; $theme->id = $theme->slug;
$theme->screenshot = array( $theme->screenshot_url ); $theme->screenshot = array( $theme->screenshot_url );
$theme->authorAndUri = $theme->author; $theme->authorAndUri = $theme->author;
$theme->parent = ( $theme->slug === $theme->template ) ? false : $theme->template; // The .org API does not seem to return the parent in a documented way; however, this check should yield a similar result in most cases. // The .org API can return the full parent theme details if passed the 'parent' arg, or if passed the 'template' option it'll return that in the event it's a child theme.
if ( isset( $theme->parent ) ) {
$theme->parent = $theme->parent['slug'];
} else {
$theme->parent = false;
}
unset( $theme->slug ); unset( $theme->slug );
unset( $theme->screenshot_url ); unset( $theme->screenshot_url );
unset( $theme->author ); unset( $theme->author );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-RC1-42121'; $wp_version = '4.9-RC1-42122';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.