+++ /dev/null
-<?php
-
-namespace Civi\Api4;
-
-/**
- * Class AfformPalette
- * @searchable false
- * @package Civi\Api4
- */
-class AfformPalette extends Generic\AbstractEntity {
-
- /**
- * @param bool $checkPermissions
- * @return Generic\BasicGetAction
- */
- public static function get($checkPermissions = TRUE) {
- return (new Generic\BasicGetAction('AfformPalette', __FUNCTION__, function() {
- return [
- [
- 'id' => 'Parent:afl-name',
- 'entity' => 'Parent',
- 'title' => 'Name',
- 'template' => '<afl-name contact-id="entities.parent.id" afl-label="Name"/>',
- ],
- [
- 'id' => 'Parent:afl-address',
- 'entity' => 'Parent',
- 'title' => 'Address',
- 'template' => '<afl-address contact-id="entities.parent.id" afl-label="Address"/>',
- ],
- ];
- }))->setCheckPermissions($checkPermissions);
- }
-
- /**
- * @param bool $checkPermissions
- * @return Generic\BasicGetFieldsAction
- */
- public static function getFields($checkPermissions = TRUE) {
- return (new Generic\BasicGetFieldsAction('AfformPalette', __FUNCTION__, function() {
- return [
- [
- 'name' => 'id',
- ],
- [
- 'name' => 'entity',
- ],
- [
- 'name' => 'title',
- ],
- [
- 'name' => 'template',
- ],
- ];
- }))->setCheckPermissions($checkPermissions);
- }
-
- /**
- * @return array
- */
- public static function permissions() {
- return [
- "meta" => ["access CiviCRM"],
- "default" => ["administer CiviCRM"],
- ];
- }
-
-}
+++ /dev/null
-<?php
-namespace Civi\Api4;
-
-/**
- * Class AfformTag
- * @searchable false
- * @package Civi\Api4
- */
-class AfformTag extends Generic\AbstractEntity {
-
- /**
- * @param bool $checkPermissions
- * @return Generic\BasicGetAction
- */
- public static function get($checkPermissions = TRUE) {
- return (new Generic\BasicGetAction('AfformTag', __FUNCTION__, function() {
- return [
- [
- 'name' => 'afl-entity',
- 'attrs' => ['entity-name', 'matching-rule', 'assigned-values'],
- ],
- [
- 'name' => 'afl-name',
- 'attrs' => ['contact-id', 'afl-label'],
- ],
- [
- 'name' => 'afl-contact-email',
- 'attrs' => ['contact-id', 'afl-label'],
- ],
- ];
- }))->setCheckPermissions($checkPermissions);
- }
-
- /**
- * @param bool $checkPermissions
- * @return Generic\BasicGetFieldsAction
- */
- public static function getFields($checkPermissions = TRUE) {
- return (new Generic\BasicGetFieldsAction('AfformTag', __FUNCTION__, function() {
- return [
- [
- 'name' => 'name',
- ],
- [
- 'name' => 'attrs',
- ],
- ];
- }))->setCheckPermissions($checkPermissions);
- }
-
- /**
- * @return array
- */
- public static function permissions() {
- return [
- "meta" => ["access CiviCRM"],
- "default" => ["administer CiviCRM"],
- ];
- }
-
-}
+++ /dev/null
-<?php
-
-/**
- * AfformPalette API Test
- * @group headless
- */
-class api_v4_AfformPaletteTest extends api_v4_AfformTestCase {
-
- public function testGetPalette() {
- $r = Civi\Api4\AfformPalette::get()
- ->addWhere('id', '=', 'Parent:afl-name')
- ->execute();
- $this->assertEquals(1, $r->count());
-
- $r = Civi\Api4\AfformPalette::get()
- ->setLimit(10)
- ->execute();
- $this->assertTrue($r->count() > 1);
- }
-
-}