Customizer: Prevent `nav_menu_item` settings from becoming dirty when their controls are set up.

Since `wp_setup_nav_menu_item()` returns the `classes` property as an array but the Customizer manages the value as a string, the setting needs to initially export the value as a string. This prevents the `classes` property type change from causing the setting to get marked as dirty even though nothing changed. This is a regression from [34788].

See #34111.


git-svn-id: https://develop.svn.wordpress.org/trunk@35308 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2015-10-20 22:44:44 +00:00
parent bde89adaf8
commit ede4050ace
1 changed files with 5 additions and 0 deletions

View File

@ -1151,6 +1151,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
$this->value[ $key ] = intval( $this->value[ $key ] );
}
}
foreach ( array( 'classes', 'xfn' ) as $key ) {
if ( is_array( $this->value[ $key ] ) ) {
$this->value[ $key ] = implode( ' ', $this->value[ $key ] );
}
}
if ( ! isset( $this->value['_invalid'] ) ) {
$this->value['_invalid'] = (