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 | ||
13 | /** | |
14 | * | |
15 | * @package CRM | |
ca5cec67 | 16 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
380f3545 TO |
17 | */ |
18 | ||
19 | ||
19b53e5b C |
20 | namespace Civi\Api4; |
21 | ||
22 | /** | |
23 | * Retrieves information about all Api4 entities. | |
24 | * | |
0493ec47 CW |
25 | * @see \Civi\Api4\Generic\AbstractEntity |
26 | * | |
aa998597 | 27 | * @searchable none |
19b53e5b C |
28 | * @package Civi\Api4 |
29 | */ | |
30 | class Entity extends Generic\AbstractEntity { | |
31 | ||
32 | /** | |
6764a9d3 | 33 | * @param bool $checkPermissions |
19b53e5b C |
34 | * @return Action\Entity\Get |
35 | */ | |
6764a9d3 CW |
36 | public static function get($checkPermissions = TRUE) { |
37 | return (new Action\Entity\Get('Entity', __FUNCTION__)) | |
38 | ->setCheckPermissions($checkPermissions); | |
19b53e5b C |
39 | } |
40 | ||
41 | /** | |
6764a9d3 CW |
42 | * @param bool $checkPermissions |
43 | * @return Generic\BasicGetFieldsAction | |
19b53e5b | 44 | */ |
6764a9d3 CW |
45 | public static function getFields($checkPermissions = TRUE) { |
46 | return (new Generic\BasicGetFieldsAction('Entity', __FUNCTION__, function() { | |
19b53e5b | 47 | return [ |
f827fe49 CW |
48 | [ |
49 | 'name' => 'name', | |
50 | 'description' => 'Entity name', | |
51 | ], | |
60f88aac CW |
52 | [ |
53 | 'name' => 'title', | |
9813ae79 CW |
54 | 'description' => 'Localized title (singular)', |
55 | ], | |
56 | [ | |
57 | 'name' => 'title_plural', | |
58 | 'description' => 'Localized title (plural)', | |
60f88aac | 59 | ], |
90908aac CW |
60 | [ |
61 | 'name' => 'type', | |
465bc32a | 62 | 'data_type' => 'Array', |
90908aac | 63 | 'description' => 'Base class for this entity', |
465bc32a CW |
64 | 'options' => [ |
65 | 'AbstractEntity' => 'AbstractEntity', | |
66 | 'DAOEntity' => 'DAOEntity', | |
67 | 'BasicEntity' => 'BasicEntity', | |
68 | 'EntityBridge' => 'EntityBridge', | |
69 | 'OptionList' => 'OptionList', | |
70 | ], | |
90908aac | 71 | ], |
f827fe49 CW |
72 | [ |
73 | 'name' => 'description', | |
74 | 'description' => 'Description from docblock', | |
75 | ], | |
76 | [ | |
77 | 'name' => 'comment', | |
78 | 'description' => 'Comments from docblock', | |
79 | ], | |
60f88aac CW |
80 | [ |
81 | 'name' => 'icon', | |
82 | 'description' => 'crm-i icon class associated with this entity', | |
83 | ], | |
84 | [ | |
85 | 'name' => 'dao', | |
86 | 'description' => 'Class name for dao-based entities', | |
87 | ], | |
8ab43c93 | 88 | [ |
b441e024 | 89 | 'name' => 'label_field', |
8ab43c93 CW |
90 | 'description' => 'Field to show when displaying a record', |
91 | ], | |
09815e9c CW |
92 | [ |
93 | 'name' => 'searchable', | |
aa998597 CW |
94 | 'description' => 'How should this entity be presented in search UIs', |
95 | 'options' => [ | |
96 | 'primary' => ts('Primary'), | |
97 | 'secondary' => ts('Secondary'), | |
98 | 'none' => ts('None'), | |
99 | ], | |
09815e9c | 100 | ], |
a7bd99ff CW |
101 | [ |
102 | 'name' => 'paths', | |
103 | 'data_type' => 'Array', | |
104 | 'description' => 'System paths for accessing this entity', | |
105 | ], | |
f827fe49 CW |
106 | [ |
107 | 'name' => 'see', | |
e15f9453 | 108 | 'data_type' => 'Array', |
f827fe49 CW |
109 | 'description' => 'Any @see annotations from docblock', |
110 | ], | |
c5368b3b CW |
111 | [ |
112 | 'name' => 'bridge', | |
113 | 'data_type' => 'Array', | |
114 | 'description' => 'Connecting fields for EntityBridge types', | |
115 | ], | |
2f616560 CW |
116 | [ |
117 | 'name' => 'ui_join_filters', | |
118 | 'data_type' => 'Array', | |
119 | 'description' => 'When joining entities in the UI, which fields should be presented by default in the ON clause', | |
120 | ], | |
19b53e5b | 121 | ]; |
6764a9d3 | 122 | }))->setCheckPermissions($checkPermissions); |
19b53e5b C |
123 | } |
124 | ||
125 | /** | |
6764a9d3 | 126 | * @param bool $checkPermissions |
19b53e5b C |
127 | * @return Action\Entity\GetLinks |
128 | */ | |
6764a9d3 CW |
129 | public static function getLinks($checkPermissions = TRUE) { |
130 | return (new Action\Entity\GetLinks('Entity', __FUNCTION__)) | |
131 | ->setCheckPermissions($checkPermissions); | |
19b53e5b C |
132 | } |
133 | ||
134 | /** | |
135 | * @return array | |
136 | */ | |
137 | public static function permissions() { | |
138 | return [ | |
139 | 'default' => ['access CiviCRM'], | |
140 | ]; | |
141 | } | |
142 | ||
143 | } |