From 78f27051a594273d6af1e6b4472672e069005b37 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 10 May 2018 11:13:21 -0400 Subject: [PATCH] ApiExplorer - Output short array syntax --- templates/CRM/Admin/Page/APIExplorer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index 7769e4a33e..b562e133a1 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -585,13 +585,13 @@ $.each(val, function(k, v) { ret += (ret ? ', ' : '') + "'" + k + "' => " + phpFormat(v); }); - return 'array(' + ret + ')'; + return '[' + ret + ']'; } if ($.isArray(val)) { $.each(val, function(k, v) { ret += (ret ? ', ' : '') + phpFormat(v); }); - return 'array(' + ret + ')'; + return '[' + ret + ']'; } return JSON.stringify(val).replace(/\$/g, '\\$'); } @@ -716,7 +716,7 @@ js = key === 'return' && action !== 'getvalue' ? JSON.stringify(evaluate(value, true)) : json, php = key === 'return' && action !== 'getvalue' ? phpFormat(evaluate(value, true)) : phpFormat(value); if (!(i++)) { - q.php += ", array(\n"; + q.php += ", [\n"; q.json += ", {\n"; } else { q.json += ",\n"; @@ -733,10 +733,10 @@ q.wpcli += key + '=' + json + ' '; }); if (i) { - q.php += ")"; + q.php += "]"; q.json += "\n}"; } - q.php += ");"; + q.php += "];"; q.json += ").done(function(result) {\n // do something\n});"; q.smarty += "}\n{foreach from=$result.values item=" + entity.toLowerCase() + "}\n {$" + entity.toLowerCase() + ".some_field}\n{/foreach}"; if (!_.includes(action, 'get')) { -- 2.25.1