$props['action'] = $this->getApiAction();
}
// Get field metadata.
- $fieldSpec = civicrm_api3($props['entity'], 'getfield', array('options' => array('get_options' => 1)) + $props);
+ $fieldSpec = civicrm_api3($props['entity'], 'getfield', $props);
$fieldSpec = $fieldSpec['values'];
$label = CRM_Utils_Array::value('label', $props, $fieldSpec['title']);
}
// Turn off sequential to make the field easier to find
$apiRequest['params']['sequential'] = 0;
- if (!empty($params['options']['get_options'])) {
+ if (isset($params['get_options'])) {
+ $apiRequest['params']['options']['get_options_context'] = $params['get_options'];
$apiRequest['params']['options']['get_options'] = $fieldName;
}
- if (isset($params['context'])) {
- $apiRequest['params']['options']['get_options_context'] = $params['context'];
- }
$result = civicrm_api3_generic_getfields($apiRequest, FALSE);
$result = $result['values'][$fieldName];
// Fix sequential options since we forced it off
'type' => CRM_Utils_Type::T_STRING,
'api.aliases' => array('api_action'),
),
- 'context' => array(
- 'title' => 'Context',
- 'description' => 'Context passed to getoptions. Only relevant if options.get_options is set.',
+ 'get_options' => array(
+ 'title' => 'Get Options',
+ 'description' => 'Context for which to get field options, or null to skip fetching options.',
'type' => CRM_Utils_Type::T_STRING,
'options' => CRM_Core_DAO::buildOptionsContext(),
+ 'api.aliases' => array('context'),
),
);
// Add available options to these params if requested