* API result array
*/
function civicrm_api3_option_value_get($params) {
-
- if (empty($params['option_group_id']) && !empty($params['option_group_name'])) {
- $opt = array('version' => 3, 'name' => $params['option_group_name']);
- $optionGroup = civicrm_api('OptionGroup', 'Get', $opt);
- if (empty($optionGroup['id'])) {
- return civicrm_api3_create_error("option group name does not correlate to a single option group");
- }
- $params['option_group_id'] = $optionGroup['id'];
- }
-
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
+/**
+ * Adjust Metadata for get action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
+ *
+ * @param array $params
+ * Array of parameters determined by getfields.
+ */
+function _civicrm_api3_option_value_get_spec(&$params) {
+ $params['option_group_id']['api.aliases'] = array('option_group_name');
+}
+
/**
* Add an OptionValue.
*