Example #1
0
 /**
  * @return Form
  */
 public function create($name)
 {
     $form = new Form();
     $form->enableLocalized();
     $text = $this->textManager->getText($name);
     $this->text = $text;
     $form->addTextArea('text')->setValue($text->text)->setAttribute('id', 'ckeditor');
     $form->addSubmit('submit', 'save')->setAttribute('class', 'btn btn-primary btn-purple btn-flat');
     $form->onSuccess[] = array($this, 'formSucceeded');
     return $form;
 }
Example #2
0
 public function getText($params, \Nette\Application\UI\Presenter $presenter, $default_text = null)
 {
     if (!isset($params[0])) {
         throw new \Exception("gettext macro must define 1 parameter {getText 'textName'}");
     }
     $name = $params[0];
     $default_text = htmlspecialchars_decode($default_text);
     $text = $this->textManager->getText($name);
     $texy = new \Texy\Texy();
     if (!$text) {
         $this->textManager->addText($name, $presenter->name . ':' . $presenter->getAction(), $default_text);
         return $texy->process($default_text);
     } else {
         return $texy->process($text->text);
     }
 }
Example #3
0
 public function renderEditText($name)
 {
     $this->template->text = $this->textManager->getText($name);
 }