Customize: Fix theme details modal by updating logic in `getPreviousTheme` and `getNextTheme` to not rely on DOM traversal and manually constructing control IDs.
Amends [41726]. See #42083, #37661. Built from https://develop.svn.wordpress.org/trunk@41739 git-svn-id: http://core.svn.wordpress.org/trunk@41573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f646f0aa47
commit
55ba2f5e53
|
@ -2208,19 +2208,22 @@
|
||||||
*
|
*
|
||||||
* @since 4.2.0
|
* @since 4.2.0
|
||||||
*
|
*
|
||||||
* @returns {object|boolean} Next theme.
|
* @returns {wp.customize.ThemeControl|boolean} Next theme.
|
||||||
*/
|
*/
|
||||||
getNextTheme: function () {
|
getNextTheme: function () {
|
||||||
var section = this, control, next;
|
var section = this, control, nextControl, sectionControls, i;
|
||||||
control = api.control( section.params.action + '_theme_' + this.currentTheme );
|
control = api.control( section.params.action + '_theme_' + section.currentTheme );
|
||||||
next = control.container.next( 'li.customize-control-theme' );
|
sectionControls = section.controls();
|
||||||
if ( ! next.length ) {
|
i = _.indexOf( sectionControls, control );
|
||||||
|
if ( -1 === i ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
next = next[0].id.replace( 'customize-control-theme-' + section.params.action, section.params.action + '_theme' );
|
|
||||||
control = api.control( next );
|
|
||||||
|
|
||||||
return control.params.theme;
|
nextControl = sectionControls[ i + 1 ];
|
||||||
|
if ( ! nextControl ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return nextControl.params.theme;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2242,19 +2245,22 @@
|
||||||
* Get the previous theme model.
|
* Get the previous theme model.
|
||||||
*
|
*
|
||||||
* @since 4.2.0
|
* @since 4.2.0
|
||||||
* @returns {object|boolean} Previous theme.
|
* @returns {wp.customize.ThemeControl|boolean} Previous theme.
|
||||||
*/
|
*/
|
||||||
getPreviousTheme: function () {
|
getPreviousTheme: function () {
|
||||||
var section = this, control, previous;
|
var section = this, control, nextControl, sectionControls, i;
|
||||||
control = api.control( section.params.action + '_theme_' + this.currentTheme );
|
control = api.control( section.params.action + '_theme_' + section.currentTheme );
|
||||||
previous = control.container.prev( 'li.customize-control-theme' );
|
sectionControls = section.controls();
|
||||||
if ( ! previous.length ) {
|
i = _.indexOf( sectionControls, control );
|
||||||
|
if ( -1 === i ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
previous = previous[0].id.replace( 'customize-control-theme-' + section.params.action, section.params.action + '_theme' );
|
|
||||||
control = api.control( previous );
|
|
||||||
|
|
||||||
return control.params.theme;
|
nextControl = sectionControls[ i - 1 ];
|
||||||
|
if ( ! nextControl ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return nextControl.params.theme;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-alpha-41738';
|
$wp_version = '4.9-alpha-41739';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue