FOUR-18107 - feature/FOUR-18103: Support for drafts (hidden variable in screen data) by CarliPinell · Pull Request #7336 · ProcessMaker/processmaker

@@ -1,20 +1,16 @@ <?php
namespace ProcessMaker\Traits;
use Illuminate\Support\Arr; use Log; use ProcessMaker\Models\Column; use ProcessMaker\Models\Screen;
trait HasScreenFields { private $parsedFields;
private $restrictedComponents = [ 'FormImage', ];
public function getFieldsAttribute() { if (empty($this->parsedFields)) { Expand All @@ -35,7 +31,6 @@ public function getFieldsAttribute() ]); } }
return $this->parsedFields->unique('field'); }
Expand All @@ -47,15 +42,25 @@ public function parseNestedScreen($node) } }
public function parseCollectionRecordControl($node) { $collection = Screen::find($node['config']['collection']['screen']); foreach ($collection->fields as $field) { $this->parsedFields->push($field); } }
public function walkArray($array, $key = null) { if (!is_array($array)) { $array = json_decode($array); }
foreach ($array as $subkey => $value) {
if (isset($value['component']) && $value['component'] === 'FormNestedScreen') { $this->parseNestedScreen($value); } elseif (isset($value['component']) && $value['component'] === 'FormCollectionRecordControl') { $this->parseCollectionRecordControl($value); } elseif ($key !== 'inspector' && is_array($value) && isset($value['config']['name'])) { $this->parseItem($value); } Expand Down Expand Up @@ -97,11 +102,9 @@ public function parseItemLabel($item) public function parseItemFormat($item) { $format = 'string';
if (isset($item['config']['dataFormat'])) { $format = $item['config']['dataFormat']; }
if (isset($item['component'])) { switch ($item['component']) { case 'FileUpload': Expand All @@ -128,7 +131,6 @@ public function parseItemFormat($item) break; } }
return $format; }
Expand All @@ -151,6 +153,7 @@ public function parseIsSubmitButton($item) * * @return array */
public function screenFilteredFields() { return $this->fields->pluck('field'); Expand Down