Exemplo n.º 1
0
 /**
  * @param int $id
  */
 public function renderEdit($id = 0)
 {
     /** @var Form $form */
     $form = $this['editForm'];
     if (!$form->isSubmitted()) {
         $item = $this->pagesRepository->get($id);
         $row = $this->pagesRepository->itemToArray($item);
         if (!$row) {
             throw new PDOException('Záznam nenalezen');
         }
         $row['inMenu'] = json_decode($row['inMenu'], true);
         $row['galleryIds'] = json_decode($row['galleryIds'], true);
         $form->setDefaults($row);
         $this->getTemplate()->picture = $item->pictureName();
     }
 }