public function renderForm($id = NULL) { $newCategory = TRUE; if ($id) { /** @var Form $form */ $form = $this['categoryForm']; $category = $this->categoryManager->getById($id); $form->setDefaults(['category_id' => $category['id'], 'title' => $category['title']]); $newCategory = FALSE; } $this->template->newCategory = $newCategory; }