blob: 733776b7245d474f4707cccdb9b60cdac4c2478e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
}
}
|