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;
q.php += " '" + key + "' => " + phpFormat(value) + ",\n";
q.json += " \"" + key + '": ' + js;
q.smarty += ' ' + key + '=' + smartyFormat(js, key);
+ q.drush += key + '=' + value + ' ';
});
if (i) {
q.php += ")";
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);
<tr><td>Smarty</td><td><pre class="prettyprint linenums" id="api-smarty" title='smarty syntax (for get actions)'></pre></td></tr>
<tr><td>Php</td><td><pre class="prettyprint linenums" id="api-php" title='php syntax'></pre></td></tr>
<tr><td>Javascript</td><td><pre class="prettyprint linenums" id="api-json" title='javascript syntax'></pre></td></tr>
+ {if $config->userSystem->is_drupal}
+ <tr><td>Drush</td><td><pre class="prettyprint linenums" id="api-drush" title='drush syntax'></pre></td></tr>
+ {/if}
</table>
</div>
<input type="submit" value="{ts}Execute{/ts}" class="crm-form-submit"/>