public function renderEdit($id = 0) { $form = $this['addReference']; if (!$form->isSubmitted()) { $ref = new Reference(); $row = $ref->find($id)->fetch(); if (!$row) { throw new NBadRequestException('Record not found!'); } // Set position checkboxes $row['pos'] = $this->getPositionCheckboxes($row['binaryPos']); $form->setDefaults($row); } // Used for attached images $this->template->row = $row; }