diff options
author | Daniel Weipert <code@drogueronin.de> | 2022-03-06 00:48:14 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2022-03-06 00:48:14 +0100 |
commit | b2a86c7df7d5a473e80034832a01b21444fa50e6 (patch) | |
tree | 2b18e08124ff3e8602a20ba27fef3ae4d066cc28 /src/Controllers/FieldsController.php | |
parent | df428380e288db75b41ace5d6274f44916517f9f (diff) |
Refactor
Diffstat (limited to 'src/Controllers/FieldsController.php')
-rw-r--r-- | src/Controllers/FieldsController.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Controllers/FieldsController.php b/src/Controllers/FieldsController.php new file mode 100644 index 0000000..c407604 --- /dev/null +++ b/src/Controllers/FieldsController.php @@ -0,0 +1,25 @@ +<?php + +namespace FlatFileForms\Controllers; + +use FlatFileForms\Builder; + +class FieldsController +{ + public function getFields(Builder $builder): array + { + /**@var Utilities $utilities*/ + global $utilities; + + $fields = $builder->buildFields($_GET['page'] ?? null); + + // flatten paged form + if ($utilities->isPagedFieldSet($fields) && isset($_GET['flat'])) { + $fields = array_merge(...array_values($fields)); + } + + $content['data'] = $fields; + + return $content; + } +} |