Skip to content

Commit

Permalink
Add field type for Contact:preferred_language
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Tubach committed Sep 18, 2024
1 parent d35f9f4 commit 37b679f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ public function getFieldTypes(): iterable {
'validation' => 'Text',
'maxLength' => 255,
]);

yield new OptionGroupType(
'preferred_language',
E::ts('Preferred Language'),
$this->optionsLoader->getOptions('Contact', 'preferred_language'),
[
'label' => E::ts('Preferred Language'),
'target' => 'Contact:preferred_language',
'required' => FALSE,
'validation' => 'String',
]
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ remoteEventFormEditorModule.directive('selectInitialOption', function () {
controller: ['$scope', function ($scope) {
$scope.ts = CRM.ts('remoteeventformeditor');
if (!Object.values($scope.allowed).includes($scope.value)) {
$scope.value = undefined;
$scope.value = null;
}
}],
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<select id="{{id}}" class="form-control" ng-model="value" ng-required="required">
<option ng-if="!required"></option>
<option ng-repeat="(label, value) in options" ng-show="allowed.includes(value)" ng-value="{{value}}">{{label}}</option>
<option ng-value="null" ng-if="!required"></option>
<option ng-repeat="(label, value) in options" ng-show="allowed.includes(value)" ng-value="value">{{label}}</option>
</select>

0 comments on commit 37b679f

Please sign in to comment.