protected function createComponentSettings() { $form = new \CustomForm(); $form->addUpload('logo', 'Logo')->addCondition(\Nette\Application\UI\Form::FILLED)->addRule(\Nette\Application\UI\Form::IMAGE, 'Soubor musí být JPEG, PNG nebo GIF.'); $form->addText('title', 'Titulek stránky', 64); $form->addText('description', 'Popis stránky', 256); $form->addText('keywords', 'Klíčová slova stránky', 512); $form->addText('email', 'Hlavní e-mail', 512); $form->addHidden("layout"); $form->addText('layoutVisible', 'Layout')->setDisabled()->setValue($this->settings["layout"]->getTitle()); $form->addSubmit('setLayout', 'Vybrat jiný layout')->setAttribute("data-toggle", "modal")->setAttribute("data-target", "#layoutWizard")->setAttribute("type", "button"); $form->addSubmit('addPage', 'Uložit'); $defaults = $this->settings; $defaults["layout"] = $this->settings["layout"]->getName(); $form->setDefaults($defaults); $form->onSuccess[] = array($this, 'addPageModuleToPageFormSucceeded'); $form->setCustomRenderer(); return $form; }
function editItem_postFormFeed() { } function editItem_preUpdate() { $_REQUEST['metadata'] = json_encode($_REQUEST); } function addItem_postInsertion() { // boh } } $main = new Skin(); $form = new CustomForm("dataEntry", $confEntity); $form->addSection("Twitter Connection"); $form->addHidden("metadata", ""); $form->addText("twaccount", "Twitter Account", 50); $form->addText("twcount", "No. Tweets", 4); $form->addText("twconsumerkey", "Consumer Key", 70); $form->addText("twconsumersecret", "Consumer Secret", 70); $form->addText("twaccesstoken", "Access Token", 70); $form->addText("twaccesstokensecret", "Access Token Secret", 70); if (!isset($_REQUEST['action'])) { $_REQUEST['action'] = "edit"; } switch ($_REQUEST['action']) { case "add": $main->setContent("body", $form->addItem()); break; case "edit": $main->setContent("body", $form->editItem());