Add different rendering for sidebar widget preview type
[MAILPOET-2743]
This commit is contained in:
committed by
Veljko V
parent
e7b4ab1dfe
commit
4cb7ba2424
@ -44,7 +44,14 @@ class PreviewPage {
|
||||
if (!is_array($formData)) {
|
||||
return '';
|
||||
}
|
||||
return $this->getPostContent() . $this->getFormContent($formData, $formId, $formType);
|
||||
return $this->templateRenderer->render(
|
||||
'form/form_preview.html',
|
||||
[
|
||||
'post' => $this->getPostContent(),
|
||||
'form' => $this->getFormContent($formData, $formId, $formType),
|
||||
'formType' => $formType,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function renderTitle() {
|
||||
|
25
lib/Form/PreviewWidget.php
Normal file
25
lib/Form/PreviewWidget.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Form;
|
||||
|
||||
class PreviewWidget extends \WP_Widget {
|
||||
|
||||
/** @var string */
|
||||
private $formHtml;
|
||||
|
||||
public function __construct($formHtml) {
|
||||
$this->formHtml = $formHtml;
|
||||
parent::__construct(
|
||||
'mailpoet_form_preview',
|
||||
'Dummy form form preview',
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the widget itself.
|
||||
*/
|
||||
public function widget($args, $instance = null) {
|
||||
echo $this->formHtml;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user