diff --git a/CRM/Api4/Page/Api4Explorer.php b/CRM/Api4/Page/Api4Explorer.php index adc1d74326dd..0353d91772ef 100644 --- a/CRM/Api4/Page/Api4Explorer.php +++ b/CRM/Api4/Page/Api4Explorer.php @@ -21,16 +21,18 @@ class CRM_Api4_Page_Api4Explorer extends CRM_Core_Page { public function run() { $apiDoc = new ReflectionFunction('civicrm_api4'); + $groupOptions = civicrm_api4('Group', 'getFields', ['loadOptions' => TRUE, 'select' => ['options', 'name'], 'where' => [['name', 'IN', ['visibility', 'group_type']]]]); $vars = [ 'operators' => \CRM_Core_DAO::acceptedSQLOperators(), 'basePath' => Civi::resources()->getUrl('civicrm'), - 'schema' => (array) \Civi\Api4\Entity::get()->setChain(['fields' => ['$name', 'getFields']])->execute(), - 'links' => (array) \Civi\Api4\Entity::getLinks()->execute(), + 'schema' => \Civi\Api4\Entity::get()->setChain(['fields' => ['$name', 'getFields']])->execute(), + 'links' => \Civi\Api4\Entity::getLinks()->execute(), 'docs' => \Civi\Api4\Utils\ReflectionUtils::parseDocBlock($apiDoc->getDocComment()), + 'groupOptions' => array_column((array) $groupOptions, 'options', 'name'), ]; Civi::resources() ->addVars('api4', $vars) - ->addPermissions(['access debug output']) + ->addPermissions(['access debug output', 'edit groups', 'administer reserved groups']) ->addScriptFile('civicrm', 'js/load-bootstrap.js') ->addScriptFile('civicrm', 'bower_components/js-yaml/dist/js-yaml.min.js') ->addScriptFile('civicrm', 'bower_components/marked/marked.min.js') diff --git a/ang/api4Explorer.ang.php b/ang/api4Explorer.ang.php index 816856b86df8..2eec108aaf14 100644 --- a/ang/api4Explorer.ang.php +++ b/ang/api4Explorer.ang.php @@ -13,5 +13,5 @@ 'ang/api4Explorer', ], 'basePages' => [], - 'requires' => ['crmUi', 'crmUtil', 'ngRoute', 'crmRouteBinder', 'ui.sortable', 'api4', 'ngSanitize', 'dialogService'], + 'requires' => ['crmUi', 'crmUtil', 'ngRoute', 'crmRouteBinder', 'ui.sortable', 'api4', 'ngSanitize', 'dialogService', 'checklist-model'], ]; diff --git a/ang/api4Explorer/Explorer.html b/ang/api4Explorer/Explorer.html index 90d3287deb4b..659917ecb2fe 100644 --- a/ang/api4Explorer/Explorer.html +++ b/ang/api4Explorer/Explorer.html @@ -26,7 +26,7 @@