if (ctrl.node.defn && ctrl.node.defn.options) {
return ctrl.node.defn.options;
}
+ if (_.includes(['Date', 'Timestamp'], $scope.getProp('data_type'))) {
+ return CRM.afGuiEditor.dateRanges;
+ }
return ctrl.getDefn().options || ($scope.getProp('input_type') === 'CheckBox' ? null : yesNo);
};
switch (type) {
case 'CheckBox':
case 'Radio':
+ return defn.options || defn.data_type === 'Boolean';
+
case 'Select':
- return !(!defn.options && defn.data_type !== 'Boolean');
+ return defn.options || defn.data_type === 'Boolean' || defn.input_type === 'Date';
+
+ case 'Date':
+ return defn.input_type === 'Date';
case 'TextArea':
case 'RichTextEditor':
return (defn.data_type === 'Text' || defn.data_type === 'String');
+
+ case 'ChainSelect':
+ return defn.input_type === 'ChainSelect';
+
+ default:
+ return true;
}
- return true;
};
// Returns a value from either the local field defn or the base defn
}
$fieldDefn = $existingFieldDefn ? \CRM_Utils_JS::getRawProps($existingFieldDefn) : [];
+
+ if ('Date' === $fieldInfo['input_type'] && !empty($fieldDefn['input_type']) && \CRM_Utils_JS::decode($fieldDefn['input_type']) === 'Select') {
+ $fieldInfo['input_attrs']['placeholder'] = ts('Select');
+ $fieldInfo['options'] = \CRM_Utils_Array::makeNonAssociative(\CRM_Core_OptionGroup::values('relative_date_filters'), 'id', 'label');
+ }
+
foreach ($fieldInfo as $name => $prop) {
// Merge array props 1 level deep
if (in_array($name, $deep) && !empty($fieldDefn[$name])) {