session->tick($dt); } private array $params = []; protected function loaded(array $params = []): void { $this->params = $params; $this->heading->text = (string)($params['title'] ?? 'Name'); $this->label->text = (string)($params['label'] ?? 'Name:'); $this->name->text = (string)($params['name'] ?? ''); $this->description->text = (string)($params['description'] ?? ''); $this->ok->text = (string)($params['ok'] ?? 'OK'); $this->error->text = ''; $this->setFocus($this->name); } public function onOkClick(mixed $sender = null): void { if (trim($this->name->text) === '') { $this->error->text = 'Enter a name.'; return; } $this->close(['name' => trim($this->name->text), 'description' => $this->description->text, 'command' => $this->params['command'] ?? '', 'target' => $this->params['target'] ?? '']); } public function onCancelClick(Button $sender): void { $this->close(); } }