Exemplo n.º 1
0
 /**
  * Action to delete a site
  * @param \ride\web\cms\Cms $cms Facade to the CMS
  * @param string $locale Code of the locale
  * @param string $site Id of the site
  * @param string $revision Name of the revision
  * @return null
  */
 public function deleteAction(Cms $cms, $locale, $site, $revision)
 {
     if (!$cms->resolveNode($site, $revision)) {
         return;
     }
     $this->setContentLocale($locale);
     $translator = $this->getTranslator();
     $referer = $this->request->getQueryParameter('referer');
     $form = $this->createFormBuilder();
     $form->addRow('recursive', 'option', array('label' => '', 'description' => $translator->translate('label.confirm.node.delete.recursive'), 'disabled' => true, 'default' => true));
     $form = $form->build();
     if ($form->isSubmitted()) {
         $data = $form->getData();
         $cms->removeNode($site, true);
         $this->addSuccess('success.node.deleted', array('node' => $site->getName($locale)));
         $this->response->setRedirect($this->getUrl('cms.site', array('locale' => $locale)));
         return;
     }
     $this->setTemplateView('cms/backend/delete.form', array('form' => $form->getView(), 'referer' => $referer, 'site' => $site, 'node' => $site, 'locale' => $locale, 'locales' => $cms->getLocales()));
 }