command, 'target' => ref] (MainForm runs it). Cancel is the default button. * * @property IconBox $icon * @property Label $message * @property CheckBox $understood * @property Button $ok * @property Button $cancel */ final class StrongConfirmForm extends Form { public function __construct(private \App\Model\Session $session) { parent::__construct(); } /** XAPI's answers, events and the console go on while this dialog is open. */ protected function tick(float $dt): void { $this->session->tick($dt); } private array $params = []; protected function loaded(array $params = []): void { $this->params = $params; $this->message->text = (string)($params['message'] ?? ''); $this->ok->text = (string)($params['ok'] ?? 'Destroy'); $this->understood->text = (string)(($params['check'] ?? '') ?: 'I understand: this cannot be undone.'); $this->understood->checked = false; $this->ok->enabled = false; } public function onUnderstoodChange(CheckBox $sender, bool $checked): void { $this->ok->enabled = $checked; } public function onOkClick(Button $sender): void { if (!$this->understood->checked) { return; } $this->close(['confirm' => $this->params['command'] ?? '', 'target' => $this->params['target'] ?? '']); } public function onCancelClick(Button $sender): void { $this->close(); } }