Skip to content

Commit

Permalink
GUI - dropdown select for permissions field
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw authored and CiviCRM committed Sep 16, 2020
1 parent 586344a commit afc0cd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ext/afform/gui/afform_gui.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ function afform_gui_civicrm_buildAsset($asset, $params, &$mimeType, &$content) {
'danger' => ts('Danger'),
];

$data['permissions'] = [];
foreach (CRM_Core_Permission::basicPermissions(TRUE, TRUE) as $name => $perm) {
$data['permissions'][] = [
'id' => $name,
'text' => $perm[0],
'description' => $perm[1] ?? NULL,
];
}

$mimeType = 'text/javascript';
$content = "CRM.afformAdminData=" . json_encode($data, JSON_UNESCAPED_SLASHES) . ';';
}
2 changes: 1 addition & 1 deletion ext/afform/gui/ang/afGuiEditor/config-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
<label for="af_config_form_permission">
{{ ts('Permission:') }}
</label>
<input ng-model="afform.permission" class="form-control" id="af_config_form_permission" />
<input ng-model="afform.permission" class="form-control" id="af_config_form_permission" crm-ui-select="{data: editor.meta.permissions, placeholder: ts('Open access')}" />

0 comments on commit afc0cd7

Please sign in to comment.