Skip to content

Commit

Permalink
Merge pull request #17 from systopia/add-field-type-preferred-language
Browse files Browse the repository at this point in the history
Add field type for `Contact:preferred_language`
  • Loading branch information
dontub authored Sep 18, 2024
2 parents d35f9f4 + 37b679f commit 38eff83
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 38eff83

Please sign in to comment.