Commit | Line | Data |
---|---|---|
19b53e5b C |
1 | <?php |
2 | ||
380f3545 TO |
3 | /* |
4 | +--------------------------------------------------------------------+ | |
41498ac5 | 5 | | Copyright CiviCRM LLC. All rights reserved. | |
380f3545 | 6 | | | |
41498ac5 TO |
7 | | This work is published under the GNU AGPLv3 license with some | |
8 | | permitted exceptions and without any warranty. For full license | | |
9 | | and copyright information, see https://civicrm.org/licensing | | |
380f3545 TO |
10 | +--------------------------------------------------------------------+ |
11 | */ | |
12 | ||
19b53e5b C |
13 | namespace Civi\Api4\Action\CustomValue; |
14 | ||
15 | use Civi\Api4\Service\Spec\SpecFormatter; | |
16 | ||
17 | /** | |
18 | * Get fields for a custom group. | |
19 | */ | |
20 | class GetFields extends \Civi\Api4\Generic\DAOGetFieldsAction { | |
21 | use \Civi\Api4\Generic\Traits\CustomValueActionTrait; | |
22 | ||
23 | protected function getRecords() { | |
24 | $fields = $this->_itemsToGet('name'); | |
25 | /** @var \Civi\Api4\Service\Spec\SpecGatherer $gatherer */ | |
26 | $gatherer = \Civi::container()->get('spec_gatherer'); | |
c752d94b | 27 | $spec = $gatherer->getSpec('Custom_' . $this->getCustomGroup(), $this->getAction(), $this->includeCustom, $this->values); |
19b53e5b C |
28 | return SpecFormatter::specToArray($spec->getFields($fields), $this->loadOptions); |
29 | } | |
30 | ||
31 | /** | |
32 | * @inheritDoc | |
33 | */ | |
34 | public function getParamInfo($param = NULL) { | |
35 | $info = parent::getParamInfo($param); | |
36 | if (!$param) { | |
37 | // This param is meaningless here. | |
38 | unset($info['includeCustom']); | |
39 | } | |
40 | return $info; | |
41 | } | |
42 | ||
43 | } |