'val' => $record[$expr],
'field' => $field,
'suffix' => substr($expr, $suffix + 1),
- 'depends' => $field['input_attrs']['controlField'] ?? NULL,
+ 'depends' => $field['input_attrs']['control_field'] ?? NULL,
];
unset($record[$expr]);
}
}
}
}
+ // Ensure all keys use lower_case not camelCase
+ foreach ($inputAttrs as $key => $val) {
+ if ($key !== strtolower($key)) {
+ unset($inputAttrs[$key]);
+ $key = strtolower(preg_replace('/(?=[A-Z])/', '_$0', $key));
+ $inputAttrs[$key] = $val;
+ }
+ }
$fieldSpec
->setInputType($inputType)
->setInputAttrs($inputAttrs);
// ChainSelect - watch control field & reload options as needed
if (ctrl.defn.input_type === 'ChainSelect') {
- $scope.$watch('dataProvider.getFieldData()[defn.input_attrs.controlField]', function(val) {
+ $scope.$watch('dataProvider.getFieldData()[defn.input_attrs.control_field]', function(val) {
if (val) {
var params = {
where: [['name', '=', ctrl.fieldName]],
loadOptions: ['id', 'label'],
values: {}
};
- params.values[ctrl.defn.input_attrs.controlField] = val;
+ params.values[ctrl.defn.input_attrs.control_field] = val;
crmApi4($scope.dataProvider.getEntityType(), 'getFields', params, 0)
.then(function(data) {
ctrl.defn.options = data.options;