Merge pull request #17636 from MikeyMJCO/patch-5
[civicrm-core.git] / Civi / Api4 / Entity.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
6 | |
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 |
10 +--------------------------------------------------------------------+
11 */
12
13 /**
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 * $Id$
18 *
19 */
20
21
22 namespace Civi\Api4;
23
24 /**
25 * Retrieves information about all Api4 entities.
26 *
27 * @see \Civi\Api4\Generic\AbstractEntity
28 *
29 * @package Civi\Api4
30 */
31 class Entity extends Generic\AbstractEntity {
32
33 /**
34 * @return Action\Entity\Get
35 */
36 public static function get() {
37 return new Action\Entity\Get('Entity', __FUNCTION__);
38 }
39
40 /**
41 * @return \Civi\Api4\Generic\BasicGetFieldsAction
42 */
43 public static function getFields() {
44 return new \Civi\Api4\Generic\BasicGetFieldsAction('Entity', __FUNCTION__, function() {
45 return [
46 [
47 'name' => 'name',
48 'description' => 'Entity name',
49 ],
50 [
51 'name' => 'title',
52 'description' => 'Localized title',
53 ],
54 [
55 'name' => 'description',
56 'description' => 'Description from docblock',
57 ],
58 [
59 'name' => 'comment',
60 'description' => 'Comments from docblock',
61 ],
62 [
63 'name' => 'icon',
64 'description' => 'crm-i icon class associated with this entity',
65 ],
66 [
67 'name' => 'dao',
68 'description' => 'Class name for dao-based entities',
69 ],
70 [
71 'name' => 'see',
72 'data_type' => 'Array',
73 'description' => 'Any @see annotations from docblock',
74 ],
75 ];
76 });
77 }
78
79 /**
80 * @return Action\Entity\GetLinks
81 */
82 public static function getLinks() {
83 return new Action\Entity\GetLinks('Entity', __FUNCTION__);
84 }
85
86 /**
87 * @return array
88 */
89 public static function permissions() {
90 return [
91 'default' => ['access CiviCRM'],
92 ];
93 }
94
95 }