controller->findSettingsFiles(); $this->layouts->assign('files', $files); return $this->layouts->get('components/settings/overview'); } /** * @throws NotFoundException */ #[HiddenAttribute, DisplayAttribute("View config file")] #[PermissionAttribute(["SUPER"])] public function view(string $request) { // Determine parts $parts = explode("/", $request); $file = $parts[0]; $selector = intval($parts[1]); // Select the file $data = $this->controller->fetchFile($file, $selector); // Create a form out of the data /** @var Forms $forms */ $forms = $this->libraries->get("forms"); $form = $forms->getForm("ConfigEdit"); foreach ($data['data'] as $key => $value) { switch (gettype($value)) { case "string": case "integer": $field = new TextField($key); $field->setLabel($key)->setValue($value)->lock(); $form->field($field); break; case "boolean": $field = new CheckboxField($key); $field->setLabel($key)->setValue($value)->lock(); $form->field($field); break; default: dump(gettype($value)); break; } } // Assign and load layout $this->layouts->assign('config', $data); $this->layouts->assign('form', $form); return $this->layouts->get('components/settings/view'); } #[HiddenAttribute, DisplayAttribute("Edit config file")] #[PermissionAttribute(["SUPER"])] public function modify() { } }