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