controller->listUsers(); $this->layouts->assign("users", $users); return $this->layouts->get("admin/users_list"); } #[HiddenAttribute] #[PermissionAttribute(["ADMIN"])] public function view(string $userId) { $info = $this->controller->getDetailedUserInformation($userId); dump($info); exit; return $userId; } #[HiddenAttribute] #[DisplayAttribute("Create User Account")] public function create() { // Prepare form /** @var Forms $forms */ $forms = $this->libraries->get("forms"); $form = $forms->getCachedForm(function (Form $form){ // First prepare the identifier field $field1 = new EmailField("identifier"); $field1->setLabel("Email address") ->placeholder("Email"); $form->field($field1); // Add additional fields through GetRegisterFieldsEvent /** @var GetRegisterFieldsEvent $event */ $event = Events::fireEvent(new GetRegisterFieldsEvent()); foreach ($event->getFields() as $field) { $field->setNote("eventField"); $form->field($field); } // Terms and conditions field $field4 = new CheckboxField("sendemail"); $field4->setLabel("Send User Registration Notification"); $field4->checked(); $form->field($field4); // Submit field $field5 = new SubmitField("submit"); $field5->setButtonText("Create User Account"); $form->field($field5); return $form; }, "AuthCreateUserForm", "Register"); // After validation, send data to the controller if ($form->validate()) { // Prepare variables $identifier = $form->getField("identifier")->getValue(); // Then forward the form to the controller try { $this->controller->register($identifier, null, [], [], true); } catch (RegisterErrorException $e) { $form->invalidate(true); $form->addFormError($e->getMessage()); } catch (RegisterWarningException $e) { $form->invalidate(true); $form->addFormWarning($e->getMessage()); } } $this->layouts->assign("form", $form); return $this->layouts->get("admin/users_create"); } }