Example #1
0
 /**
  * Creates a form to edit a Page entity.
  *
  * @param Page $entity The entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createEditForm(Page $entity)
 {
     $showParent = false;
     $showURL = true;
     if ($entity->getLvl() > 0) {
         $showParent = true;
     } else {
         $showURL = false;
     }
     $siteId = $this->getRequest()->get('site_id');
     $form = $this->createForm(new PageType(), $entity, array('action' => $this->generateUrl('cmf_admin_page_update', array('id' => $entity->getId(), 'site_id' => $siteId)), 'method' => 'PUT', 'SHOW_PARENT' => $showParent, 'SHOW_URL' => $showURL, 'SITE_ID' => $siteId));
     $form->add('submit', 'submit', array('label' => 'Сохранить', 'attr' => array('class' => 'btn btn-success')));
     return $form;
 }