From 15b11f479ace1677797baa540e1c700f41ac48d0 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 16 Apr 2019 18:24:18 -0400 Subject: [PATCH] Add getFields to api4 classes --- ext/afform/core/Civi/Api4/Afform.php | 30 +++++++++++++++++++++ ext/afform/core/Civi/Api4/AfformPalette.php | 20 ++++++++++++++ ext/afform/core/Civi/Api4/AfformTag.php | 14 ++++++++++ 3 files changed, 64 insertions(+) diff --git a/ext/afform/core/Civi/Api4/Afform.php b/ext/afform/core/Civi/Api4/Afform.php index 9136f940d8..8856f3bbe1 100644 --- a/ext/afform/core/Civi/Api4/Afform.php +++ b/ext/afform/core/Civi/Api4/Afform.php @@ -5,6 +5,7 @@ namespace Civi\Api4; use Civi\Api4\Generic\AbstractEntity; use Civi\Api4\Generic\BasicBatchAction; use Civi\Api4\Generic\BasicGetAction; +use Civi\Api4\Generic\BasicGetFieldsAction; use Civi\Api4\Generic\BasicUpdateAction; /** @@ -133,6 +134,35 @@ class Afform extends AbstractEntity { return new BasicUpdateAction('Afform', __FUNCTION__, $save, 'name'); } + public static function getFields() { + return new BasicGetFieldsAction('Afform', __FUNCTION__, function() { + return [ + [ + 'name' => 'name', + ], + [ + 'name' => 'requires', + ], + [ + 'name' => 'title', + ], + [ + 'name' => 'description', + ], + [ + 'name' => 'is_public', + 'data_type' => 'Boolean', + ], + [ + 'name' => 'server_route', + ], + [ + 'name' => 'layout', + ], + ]; + }); + } + /** * @return array */ diff --git a/ext/afform/core/Civi/Api4/AfformPalette.php b/ext/afform/core/Civi/Api4/AfformPalette.php index ad0534f12b..d6bb946879 100644 --- a/ext/afform/core/Civi/Api4/AfformPalette.php +++ b/ext/afform/core/Civi/Api4/AfformPalette.php @@ -4,6 +4,7 @@ namespace Civi\Api4; use Civi\Api4\Generic\AbstractEntity; use Civi\Api4\Generic\BasicGetAction; +use Civi\Api4\Generic\BasicGetFieldsAction; /** * Class AfformPalette @@ -33,6 +34,25 @@ class AfformPalette extends AbstractEntity { }); } + public static function getFields() { + return new BasicGetFieldsAction('Afform', __FUNCTION__, function() { + return [ + [ + 'name' => 'id', + ], + [ + 'name' => 'entity', + ], + [ + 'name' => 'title', + ], + [ + 'name' => 'template', + ], + ]; + }); + } + /** * @return array */ diff --git a/ext/afform/core/Civi/Api4/AfformTag.php b/ext/afform/core/Civi/Api4/AfformTag.php index 763664e11b..a5f91d5f4c 100644 --- a/ext/afform/core/Civi/Api4/AfformTag.php +++ b/ext/afform/core/Civi/Api4/AfformTag.php @@ -3,6 +3,7 @@ namespace Civi\Api4; use Civi\Api4\Generic\AbstractEntity; use Civi\Api4\Generic\BasicGetAction; +use Civi\Api4\Generic\BasicGetFieldsAction; /** * Class AfformTag @@ -32,6 +33,19 @@ class AfformTag extends AbstractEntity { }); } + public static function getFields() { + return new BasicGetFieldsAction('Afform', __FUNCTION__, function() { + return [ + [ + 'name' => 'name', + ], + [ + 'name' => 'attrs', + ], + ]; + }); + } + /** * @return array */ -- 2.25.1