Create a new form from template
[MAILPOET-2987]
This commit is contained in:
@ -5,6 +5,13 @@ namespace MailPoet\Form;
|
||||
use MailPoet\Models\Form;
|
||||
|
||||
class FormFactory {
|
||||
public function createFormFromTemplate(array $template) {
|
||||
if (isset($template['id'])) {
|
||||
unset($template['id']);
|
||||
}
|
||||
return Form::createOrUpdate($template);
|
||||
}
|
||||
|
||||
/** @return Form */
|
||||
public function createEmptyForm() {
|
||||
$data = [
|
||||
@ -42,6 +49,6 @@ class FormFactory {
|
||||
'segments_selected_by' => 'admin',
|
||||
],
|
||||
];
|
||||
return Form::createOrUpdate($data);
|
||||
return $this->createFormFromTemplate($data);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user