(REF) WorkflowMessageExample - Set data_type=Array. Remove serialization bits.
authorTim Otten <totten@civicrm.org>
Thu, 9 Sep 2021 04:13:05 +0000 (21:13 -0700)
committerTim Otten <totten@civicrm.org>
Mon, 13 Sep 2021 22:33:59 +0000 (15:33 -0700)
Civi/Api4/Action/WorkflowMessageExample/Get.php
Civi/Api4/WorkflowMessageExample.php

index c084fc706931251d4a2690655c6b092f3b0877e8..64cbc1f5700ea8d66b7d22840ee2300f44cf9dde 100644 (file)
@@ -33,6 +33,7 @@ class Get extends BasicGetAction {
   private $_scanner;
 
   public function _run(Result $result) {
+    $this->_scanner = new Examples();
     if ($this->select !== [] && !in_array('name', $this->select)) {
       $this->select[] = 'name';
     }
@@ -40,12 +41,7 @@ class Get extends BasicGetAction {
   }
 
   protected function getRecords() {
-    $this->_scanner = new Examples();
-    $all = $this->_scanner->findAll();
-    foreach ($all as &$example) {
-      $example['tags'] = !empty($example['tags']) ? \CRM_Utils_Array::implodePadded($example['tags']) : '';
-    }
-    return $all;
+    return $this->_scanner->findAll();
   }
 
   protected function selectArray($values) {
index 6b05bc44e10d1c43c336ff0a473f6278fb598f03..c672e6d91c052560d6b00103c28b337df0fddaa6 100644 (file)
@@ -60,8 +60,11 @@ class WorkflowMessageExample extends \Civi\Api4\Generic\AbstractEntity {
         [
           'name' => 'tags',
           'title' => 'Tags',
-          'data_type' => 'String',
-          'serialize' => \CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND,
+          'data_type' => 'Array',
+          'options'  => [
+            'preview' => ts('Preview: Display as an example in the "Preview" dialog'),
+            'phpunit' => ts('PHPUnit: Run basic sniff tests in PHPUnit using this example'),
+          ],
         ],
         [
           'name' => 'data',