3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * Search for example data.
21 class ExampleData
extends \Civi\Api4\Generic\AbstractEntity
{
24 * @param bool $checkPermissions
25 * @return Generic\AbstractGetAction
27 public static function get($checkPermissions = TRUE) {
28 return (new Action\ExampleData\
Get(__CLASS__
, __FILE__
))
29 ->setCheckPermissions($checkPermissions);
33 * @param bool $checkPermissions
34 * @return Generic\BasicGetFieldsAction
36 public static function getFields($checkPermissions = TRUE) {
37 return (new Generic\
BasicGetFieldsAction(__CLASS__
, __FUNCTION__
, function () {
41 'title' => 'Example Name',
42 'data_type' => 'String',
46 'title' => 'Example Title',
47 'data_type' => 'String',
51 'title' => 'Workflow Name',
52 'data_type' => 'String',
56 'title' => 'File Path',
57 'data_type' => 'String',
58 'description' => 'If the example is loaded from a file, this is the location.',
63 'data_type' => 'Array',
65 'preview' => ts('Preview: Display as an example in the "Preview" dialog'),
66 'phpunit' => ts('PHPUnit: Run basic sniff tests in PHPUnit using this example'),
72 'title' => 'Example data',
73 'data_type' => 'String',
74 'serialize' => \CRM_Core_DAO
::SERIALIZE_JSON
,
79 'title' => 'Test assertions',
80 'data_type' => 'String',
81 'serialize' => \CRM_Core_DAO
::SERIALIZE_JSON
,
84 }))->setCheckPermissions($checkPermissions);
90 public static function permissions() {
92 // FIXME: Perhaps use 'edit message templates' or similar?
93 "meta" => ["access CiviCRM"],
94 "default" => ["administer CiviCRM"],
101 public static function getInfo() {
102 $info = parent
::getInfo();
103 $info['primary_key'] = ['name'];