Skip to content

Commit

Permalink
Support array property
Browse files Browse the repository at this point in the history
  • Loading branch information
moon0326 committed Aug 24, 2021
1 parent 56475a9 commit 4f2d1bc
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ public function get_common_properties() {
private function render_properties_as_js( $properties ) {
$js_args_string = '';
foreach ( $properties as $key => $value ) {
$js_args_string = $js_args_string . "'$key': '" . esc_js( $value ) . "', ";
if ( is_array( $value ) ) {
$js_args_string = $js_args_string . "'$key': " . wp_json_encode( $value ) . ',';
} else {
$js_args_string = $js_args_string . "'$key': '" . esc_js( $value ) . "', ";
}
}
return $js_args_string;
}
Expand Down

0 comments on commit 4f2d1bc

Please sign in to comment.