From: Coleman Watts Date: Tue, 26 Aug 2014 09:26:46 +0000 (+0100) Subject: API explorer - add rudimentary drush support X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9405a07b69db82471ca58e986a33da6b403d270d;p=civicrm-core.git API explorer - add rudimentary drush support --- diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index 340d7a966c..028110e954 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -327,6 +327,7 @@ smarty: "{crmAPI var='result' entity='" + entity + "' action='" + action + "'", php: "$result = civicrm_api3('" + entity + "', '" + action + "'", json: "CRM.api3('" + entity + "', '" + action + "'", + drush: "drush civicrm-api " + entity + '.' + action + ' ', rest: CRM.config.resourceBase + "extern/rest.php?entity=" + entity + "&action=" + action + "&json=" + JSON.stringify(params) + "&api_key=yoursitekey&key=yourkey" }; smartyStub = false; @@ -341,6 +342,7 @@ q.php += " '" + key + "' => " + phpFormat(value) + ",\n"; q.json += " \"" + key + '": ' + js; q.smarty += ' ' + key + '=' + smartyFormat(js, key); + q.drush += key + '=' + value + ' '; }); if (i) { q.php += ")"; @@ -352,7 +354,7 @@ if (action.indexOf('get') < 0) { q.smarty = '{* Smarty API only works with get actions *}'; } else if (smartyStub) { - q.smarty = "{* Smarty does not have a syntax for array literals; assign complex variables on the server *}\n" + q.smarty; + q.smarty = "{* Smarty does not have a syntax for array literals; assign complex variables from php *}\n" + q.smarty; } $.each(q, function(type, val) { $('#api-' + type).removeClass('prettyprinted').text(val); diff --git a/templates/CRM/Admin/Page/APIExplorer.tpl b/templates/CRM/Admin/Page/APIExplorer.tpl index 6331f5e2ee..accf788f01 100644 --- a/templates/CRM/Admin/Page/APIExplorer.tpl +++ b/templates/CRM/Admin/Page/APIExplorer.tpl @@ -128,6 +128,9 @@ Smarty

       Php

       Javascript

+      {if $config->userSystem->is_drupal}
+        Drush

+      {/if}