Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Fix casting of booleans and numbers to strings in PHP exports to JS
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Mar 16, 2017
1 parent d43b570 commit 2559457
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion php/class-customize-snapshot-manager-back-compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ public function enqueue_controls_scripts() {
'snapshotExists' => ( $this->snapshot && $this->snapshot->saved() ),
) );

wp_localize_script( 'customize-snapshots-compat', '_customizeSnapshotsCompatSettings', $exports );
wp_scripts()->add_inline_script(
'customize-snapshots-compat',
sprintf( 'var _customizeSnapshotsCompatSettings = %s;', wp_json_encode( $exports ) ),
'before'
);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion php/class-customize-snapshot-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ public function enqueue_controls_scripts() {
),
) );

wp_localize_script( 'customize-snapshots', '_customizeSnapshotsSettings', $exports );
wp_scripts()->add_inline_script(
'customize-snapshots',
sprintf( 'var _customizeSnapshotsSettings = %s;', wp_json_encode( $exports ) ),
'before'
);
}

/**
Expand Down

0 comments on commit 2559457

Please sign in to comment.