Merge pull request #15351 from civicrm/5.18
[civicrm-core.git] / Civi / Api4 / Action / Setting / GetFields.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 5 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2019 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29 /**
30 *
31 * @package CRM
32 * @copyright CiviCRM LLC (c) 2004-2019
33 * $Id$
34 *
35 */
36
37 namespace Civi\Api4\Action\Setting;
38
39 /**
40 * Get information about CiviCRM settings.
41 *
42 * @method int getDomainId
43 * @method $this setDomainId(int $domainId)
44 */
45 class GetFields extends \Civi\Api4\Generic\BasicGetFieldsAction {
46
47 /**
48 * Domain id of settings. Leave NULL for default domain.
49 *
50 * @var int
51 */
52 protected $domainId;
53
54 protected function getRecords() {
55 // TODO: Waiting for filter handling to get fixed in core
56 // $names = $this->_itemsToGet('name');
57 // $filter = $names ? ['name' => $names] : [];
58 $filter = [];
59 return \Civi\Core\SettingsMetadata::getMetadata($filter, $this->domainId, $this->loadOptions);
60 }
61
62 public function fields() {
63 return [
64 [
65 'name' => 'name',
66 'data_type' => 'String',
67 ],
68 [
69 'name' => 'title',
70 'data_type' => 'String',
71 ],
72 [
73 'name' => 'description',
74 'data_type' => 'String',
75 ],
76 [
77 'name' => 'help_text',
78 'data_type' => 'String',
79 ],
80 [
81 'name' => 'default',
82 'data_type' => 'String',
83 ],
84 [
85 'name' => 'pseudoconstant',
86 'data_type' => 'String',
87 ],
88 [
89 'name' => 'options',
90 'data_type' => 'Array',
91 ],
92 [
93 'name' => 'group_name',
94 'data_type' => 'String',
95 ],
96 [
97 'name' => 'group',
98 'data_type' => 'String',
99 ],
100 [
101 'name' => 'html_type',
102 'data_type' => 'String',
103 ],
104 [
105 'name' => 'add',
106 'data_type' => 'String',
107 ],
108 [
109 'name' => 'serialize',
110 'data_type' => 'Integer',
111 ],
112 [
113 'name' => 'data_type',
114 'data_type' => 'Integer',
115 ],
116 ];
117 }
118
119 }