From: Coleman Watts Date: Fri, 9 Oct 2015 00:30:51 +0000 (-0400) Subject: apiExplorer - Encorage 'return' to be an array for php & js X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a2ea6df93805408d3ce6bb1fc1b1e29eaa37713a;p=civicrm-core.git apiExplorer - Encorage 'return' to be an array for php & js --- diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index 77a7581e92..4b1bc15d95 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -559,22 +559,25 @@ }; smartyPhp = []; $.each(params, function(key, value) { - var js = JSON.stringify(value); + var json = JSON.stringify(value), + // Encourage 'return' to be an array - at least in php & js + js = key === 'return' ? JSON.stringify(evaluate(value, true)) : json, + php = key === 'return' ? phpFormat(evaluate(value, true)) : phpFormat(value); if (!(i++)) { q.php += ", array(\n"; q.json += ", {\n"; } else { q.json += ",\n"; } - q.php += " '" + key + "' => " + phpFormat(value) + ",\n"; + q.php += " '" + key + "' => " + php + ",\n"; q.json += " \"" + key + '": ' + js; // smarty already defaults to sequential if (key !== 'sequential') { - q.smarty += ' ' + key + '=' + smartyFormat(value, js, key); + q.smarty += ' ' + key + '=' + smartyFormat(value, json, key); } // FIXME: This is not totally correct cli syntax - q.drush += key + '=' + js + ' '; - q.wpcli += key + '=' + js + ' '; + q.drush += key + '=' + json + ' '; + q.wpcli += key + '=' + json + ' '; }); if (i) { q.php += ")";