Files
piratepoet/lib/Form/FormFactory.php
Pavel Dohnal 0fd954184d Create a new form for the user
[MAILPOET-1798]
2020-02-17 19:20:36 +00:00

46 lines
1001 B
PHP

<?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);
}
}