$apiRequest->addFilter($key, $value);
}
+ // Autocomplete for field with option values
+ if ($apiRequest->getEntityName() === 'OptionValue' && !empty($fieldSpec['custom_field_id'])) {
+ $apiRequest->setKey('value');
+ }
+
if ($formType === 'qf') {
$this->autocompleteProfilePermissions($apiRequest, $formName, $fieldSpec);
}
* @searchable secondary
* @orderBy weight
* @groupWeightsBy option_group_id
- * @matchFields option_group_id,name
+ * @matchFields option_group_id,name,value
* @since 5.19
* @package Civi\Api4
*/
$this->assertEquals(['name'], $export[1]['params']['match']);
// Match optionValue by name and option_group_id
sort($export[2]['params']['match']);
- $this->assertEquals(['name', 'option_group_id'], $export[2]['params']['match']);
+ $this->assertEquals(['name', 'option_group_id', 'value'], $export[2]['params']['match']);
// Match customField by name and custom_group_id
sort($export[5]['params']['match']);
$this->assertEquals(['custom_group_id', 'name'], $export[5]['params']['match']);