/** * Generate the form's html * * @param Form $entity * @param bool $persist * * @return string */ public function generateHtml(Form $entity, $persist = true) { //generate cached HTML $templating = $this->factory->getTemplating(); $theme = $entity->getTemplate(); if (!empty($theme)) { $theme .= '|'; } $html = $templating->render($theme . 'MauticFormBundle:Builder:form.html.php', array('form' => $entity, 'theme' => $theme)); $entity->setCachedHtml($html); if ($persist) { //bypass model function as events aren't needed for this $this->getRepository()->saveEntity($entity); } return $html; }
/** * {@inheritDoc} */ public function getTemplate() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getTemplate', array()); return parent::getTemplate(); }
/** * @param Form $form * * @return string */ public function getFormScript(Form $form) { $templating = $this->factory->getTemplating(); $theme = $form->getTemplate(); if (!empty($theme)) { $theme .= '|'; } $script = $templating->render($theme . 'MauticFormBundle:Builder:script.html.php', array('form' => $form, 'theme' => $theme)); return $script; }
/** * @param Form $form * * @return string */ public function getFormScript(Form $form) { $theme = $form->getTemplate(); if (!empty($theme)) { $theme .= '|'; } $script = $this->templatingHelper->getTemplating()->render($theme . 'MauticFormBundle:Builder:script.html.php', ['form' => $form, 'theme' => $theme]); return $script; }