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. git-svn-id: https://develop.svn.wordpress.org/trunk@42122 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6f8428e8b5
commit
a397b8f6bb
|
@ -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' );
|
||||||
|
|
|
@ -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 );
|
||||||
|
|
Loading…
Reference in New Issue