From: Coleman Watts Date: Sat, 7 Mar 2015 16:53:55 +0000 (-0500) Subject: CRM-16071 - Expose field descriptions to api & explorer X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5c7169ebe41ee3a4a4b12b7291df7a8facf4fa9b;p=civicrm-core.git CRM-16071 - Expose field descriptions to api & explorer --- diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index 3a635df59e..72d8999d86 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -49,7 +49,10 @@ $('#api-params').append($(fieldTpl({name: name || ''}))); var $row = $('tr:last-child', '#api-params'); $('input.api-param-name', $row).crmSelect2({ - data: fields.concat({id: '-', text: ts('Other') + '...'}) + data: fields.concat({id: '-', text: ts('Other') + '...', description: ts('Choose a field not in this list')}), + formatResult: function(field) { + return field.text + '
' + field.description + '
'; + } }).change(); } @@ -134,6 +137,7 @@ id: field.name, text: field.title || field.name, multi: !!field['api.multiple'], + description: field.description || '', required: !(!field['api.required'] || field['api.required'] === '0') }); if (field['api.required'] && field['api.required'] !== '0') { diff --git a/templates/CRM/Admin/Page/APIExplorer.tpl b/templates/CRM/Admin/Page/APIExplorer.tpl index 76f87483a0..5ff402c142 100644 --- a/templates/CRM/Admin/Page/APIExplorer.tpl +++ b/templates/CRM/Admin/Page/APIExplorer.tpl @@ -87,6 +87,17 @@ background-image: url("{/literal}{$config->resourceBase}{literal}/i/icons/jquery-ui-52534D.png"); opacity: .8; } + .api-field-desc { + font-size: .8em; + color: #828282; + line-height: 1.3em; + } + .select2-highlighted .api-field-desc { + color: #fcfcfc; + } + .api-param-op[readonly] { + width: 4em; + } pre ol.linenums li { list-style-type: decimal; color: #CFCFCF; diff --git a/xml/templates/dao.tpl b/xml/templates/dao.tpl index e025bc8980..cd590f6c6c 100644 --- a/xml/templates/dao.tpl +++ b/xml/templates/dao.tpl @@ -164,6 +164,9 @@ class {$table.className} extends CRM_Core_DAO {ldelim} {if $field.title} 'title' => ts('{$field.title}'), {/if} +{if $field.comment} + 'description' => '{$field.comment|replace:"'":"\'"}', +{/if} {if $field.required} 'required' => {$field.required}, {/if} {* field.required *}