}
/**
- * FIXME: This should more properly be done at the api wrapper level
+ * Perform input validation on params that use the join syntax
+ *
+ * Arguably this should be done at the api wrapper level, but doing it here provides a bit more consistency
+ * in that api permissions to perform the join are checked first.
*
* @param $fieldName
* @param $value
* @throws \Exception
*/
private function validateNestedInput($fieldName, &$value) {
- list($entity, $name, $spec) = $this->getNestedField($fieldName);
- $params = array($name => $value);
- \_civicrm_api3_validate_fields($entity, 'get', $params, $spec);
- $value = $params[$name];
- }
-
- /**
- * Helper function for validateNestedInput - should be removed when that function is
- * @param $fieldName
- * @return array
- */
- private function getNestedField($fieldName) {
$stack = explode('.', $fieldName);
$spec = $this->apiFieldSpec;
$fieldName = array_pop($stack);
$entity = $spec[$name]['FKApiName'];
$spec = $spec[$name]['FKApiSpec'];
}
- return array($entity, $fieldName, $spec);
+ $params = array($fieldName => $value);
+ \_civicrm_api3_validate_fields($entity, 'get', $params, $spec);
+ $value = $params[$fieldName];
}
/**
margin: 0;
padding: 0 0 0.25em 2.5em;
}
+ #api-join li > i {
+ opacity: .5;
+ }
+ #api-join li.join-enabled > i {
+ opacity: 1;
+ }
#api-generated-wraper,
#api-result {
overflow: auto;
{literal}
<ul class="fa-ul">
<% _.forEach(joins, function(join, name) { %>
- <li>
+ <li <% if(join.checked) { %>class="join-enabled"<% } %>>
<i class="fa-li crm-i fa-reply fa-rotate-180"></i>
<label for="select-join-<%= name %>" class="api-checkbox-label">
<input type="checkbox" id="select-join-<%= name %>" value="<%= name %>" data-entity="<%= join.entity %>" <% if(join.checked) { %>checked<% } %>/>