Skip to content

Commit

Permalink
Merge pull request #29586 from totten/master-float
Browse files Browse the repository at this point in the history
APIv4 Explorer - Accept action-parameters of type "float"
  • Loading branch information
eileenmcnaughton authored Mar 2, 2024
2 parents 0babf3d + 850a963 commit 1f7b010
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ public static function checkType($value, $types) {
}
break;

case 'float':
if (\CRM_Utils_Rule::numeric($value)) {
return TRUE;
}
break;

case 'mixed':
return TRUE;

Expand Down
4 changes: 2 additions & 2 deletions ang/api4Explorer/Explorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ <h1 crm-page-title>
<label for="api4-param-action">action<span class="crm-marker" ng-if="::availableParams.action.required"> *</span></label>
<input class="form-control" crm-ui-select="{data: actions, allowClear: true, placeholder: 'None'}" id="api4-param-action" ng-model="params.action"/>
</div>
<div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in ::getGenericParams(['string', 'int'])">
<div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in ::getGenericParams(['string', 'int', 'float'])">
<label for="api4-param-{{:: name }}">{{:: name }}<span class="crm-marker" ng-if="::param.required"> *</span></label>
<input class="form-control" ng-if="::!param.options" type="{{:: param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{:: name }}" ng-model="params[name]"/>
<input class="form-control" ng-if="::!param.options" type="{{:: (param.type[0] === 'int' || param.type[0] === 'float') && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{:: name }}" ng-model="params[name]"/>
<select class="form-control" ng-if="::param.options" ng-options="o for o in ::param.options" id="api4-param-{{:: name }}" ng-model="params[name]"></select>
<a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="!!params[name]"><i class="crm-i fa-times" aria-hidden="true"></i></a>
</div>
Expand Down

0 comments on commit 1f7b010

Please sign in to comment.