| | |
| | | public function getSections():array |
| | | { |
| | | $allSections = array_map(function($section) { |
| | | return $section->getConfig; |
| | | return $section->getConfig(); |
| | | }, $this->sections); |
| | | |
| | | |
| | | if (!empty($this->sectionOrder)) { |
| | | $allSections['order'] = $this->sectionOrder; |
| | | } |
| | |
| | | foreach ($sections as $s) { |
| | | $section = new Section($s, $this); |
| | | $section->setTitle(ucwords(implode(' ', explode('-', $s)))); |
| | | $sectionFields = array_map(function ($f) { |
| | | return $f['name']; |
| | | }, array_filter($fields, function ($f) use ($s) { |
| | | $sectionFields = array_filter($fields, function ($f) use ($s) { |
| | | $tmp = array_key_exists('section', $f) && !is_null($f['section']) ? $f['section'] : 'main'; |
| | | return $s === $tmp; |
| | | })); |
| | | $section->setFields($sectionFields); |
| | | }); |
| | | $section->setFields(array_keys($sectionFields)); |
| | | $this->sections[$s] = $section; |
| | | } |
| | | } |