Create a new form for the user
[MAILPOET-1798]
This commit is contained in:
committed by
Jack Kitterhing
parent
3443f082ef
commit
0fd954184d
45
lib/Form/FormFactory.php
Normal file
45
lib/Form/FormFactory.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Form;
|
||||
|
||||
use MailPoet\Models\Form;
|
||||
|
||||
class FormFactory {
|
||||
|
||||
/** @return Form */
|
||||
public function createEmptyForm() {
|
||||
$data = [
|
||||
'name' => '',
|
||||
'body' => [
|
||||
[
|
||||
'id' => 'email',
|
||||
'name' => __('Email', 'mailpoet'),
|
||||
'type' => 'text',
|
||||
'static' => true,
|
||||
'params' => [
|
||||
'label' => __('Email', 'mailpoet'),
|
||||
'required' => true,
|
||||
'label_within' => true,
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 'submit',
|
||||
'name' => __('Submit', 'mailpoet'),
|
||||
'type' => 'submit',
|
||||
'static' => true,
|
||||
'params' => [
|
||||
'label' => __('Subscribe!', 'mailpoet'),
|
||||
],
|
||||
],
|
||||
],
|
||||
'settings' => [
|
||||
'on_success' => 'message',
|
||||
'success_message' => Form::getDefaultSuccessMessage(),
|
||||
'segments' => null,
|
||||
'segments_selected_by' => 'admin',
|
||||
],
|
||||
];
|
||||
return Form::createOrUpdate($data);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user