summaryrefslogtreecommitdiff
path: root/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php')
-rw-r--r--www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php b/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php
new file mode 100644
index 00000000..733776b7
--- /dev/null
+++ b/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Civi\Api4\Action\CustomValue;
+
+use Civi\Api4\Service\Spec\SpecGatherer;
+use Civi\Api4\Service\Spec\SpecFormatter;
+
+/**
+ * Get fields for a custom group.
+ */
+class GetFields extends \Civi\Api4\Generic\DAOGetFieldsAction {
+ use \Civi\Api4\Generic\Traits\CustomValueActionTrait;
+
+ protected function getRecords() {
+ $fields = $this->_itemsToGet('name');
+ /** @var SpecGatherer $gatherer */
+ $gatherer = \Civi::container()->get('spec_gatherer');
+ $spec = $gatherer->getSpec('Custom_' . $this->getCustomGroup(), $this->getAction(), $this->includeCustom);
+ return SpecFormatter::specToArray($spec->getFields($fields), (array) $this->select, $this->loadOptions);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getParamInfo($param = NULL) {
+ $info = parent::getParamInfo($param);
+ if (!$param) {
+ // This param is meaningless here.
+ unset($info['includeCustom']);
+ }
+ return $info;
+ }
+
+}