Skip to content

Commit 95a1dc9

Browse files
Merge pull request #670 from contactashish13/issue-669
JSON: Add ability to manipulate data before processing
2 parents 22320e3 + 136e191 commit 95a1dc9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

classes/Visualizer/Source/Json.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,9 @@ private function getJSON( $url = null ) {
389389
return null;
390390
}
391391

392-
$array = json_decode( wp_remote_retrieve_body( $response ), true );
392+
// this filter can be used to rearrange columns e.g. in candlestick charts
393+
// or to add additional data to the root.
394+
$array = apply_filters( 'visualizer_json_massage_data', json_decode( wp_remote_retrieve_body( $response ), true ), $url );
393395

394396
do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'JSON array for the endpoint is %s = ', print_r( $array, true ) ), 'debug', __FILE__, __LINE__ );
395397

0 commit comments

Comments
 (0)