Add form templates based on template1

[MAILPOET-3076]
This commit is contained in:
Rostislav Wolny
2020-09-03 17:30:52 +02:00
committed by Veljko V
parent cf8ad9d20f
commit 24fbeeb05f
8 changed files with 1320 additions and 0 deletions

View File

@ -15,6 +15,11 @@ use MailPoet\Form\Templates\Templates\Template10FixedBar;
use MailPoet\Form\Templates\Templates\Template10Popup; use MailPoet\Form\Templates\Templates\Template10Popup;
use MailPoet\Form\Templates\Templates\Template10SlideIn; use MailPoet\Form\Templates\Templates\Template10SlideIn;
use MailPoet\Form\Templates\Templates\Template10Widget; use MailPoet\Form\Templates\Templates\Template10Widget;
use MailPoet\Form\Templates\Templates\Template1BelowPages;
use MailPoet\Form\Templates\Templates\Template1FixedBar;
use MailPoet\Form\Templates\Templates\Template1Popup;
use MailPoet\Form\Templates\Templates\Template1SlideIn;
use MailPoet\Form\Templates\Templates\Template1Widget;
use MailPoet\Form\Templates\Templates\Template3BelowPages; use MailPoet\Form\Templates\Templates\Template3BelowPages;
use MailPoet\Form\Templates\Templates\Template3FixedBar; use MailPoet\Form\Templates\Templates\Template3FixedBar;
use MailPoet\Form\Templates\Templates\Template3Popup; use MailPoet\Form\Templates\Templates\Template3Popup;
@ -68,6 +73,11 @@ class FormEditor {
private $templatesRepository; private $templatesRepository;
private $activeTemplates = [ private $activeTemplates = [
Template1BelowPages::ID,
Template1FixedBar::ID,
Template1Popup::ID,
Template1SlideIn::ID,
Template1Widget::ID,
Template3BelowPages::ID, Template3BelowPages::ID,
Template3FixedBar::ID, Template3FixedBar::ID,
Template3Popup::ID, Template3Popup::ID,

View File

@ -9,6 +9,11 @@ use MailPoet\Form\Templates\Templates\Template10FixedBar;
use MailPoet\Form\Templates\Templates\Template10Popup; use MailPoet\Form\Templates\Templates\Template10Popup;
use MailPoet\Form\Templates\Templates\Template10SlideIn; use MailPoet\Form\Templates\Templates\Template10SlideIn;
use MailPoet\Form\Templates\Templates\Template10Widget; use MailPoet\Form\Templates\Templates\Template10Widget;
use MailPoet\Form\Templates\Templates\Template1BelowPages;
use MailPoet\Form\Templates\Templates\Template1FixedBar;
use MailPoet\Form\Templates\Templates\Template1Popup;
use MailPoet\Form\Templates\Templates\Template1SlideIn;
use MailPoet\Form\Templates\Templates\Template1Widget;
use MailPoet\Form\Templates\Templates\Template3BelowPages; use MailPoet\Form\Templates\Templates\Template3BelowPages;
use MailPoet\Form\Templates\Templates\Template3FixedBar; use MailPoet\Form\Templates\Templates\Template3FixedBar;
use MailPoet\Form\Templates\Templates\Template3Popup; use MailPoet\Form\Templates\Templates\Template3Popup;
@ -37,6 +42,11 @@ class TemplateRepository {
private $templates = [ private $templates = [
InitialForm::ID => InitialForm::class, InitialForm::ID => InitialForm::class,
DefaultForm::ID => DefaultForm::class, DefaultForm::ID => DefaultForm::class,
Template1BelowPages::ID => Template1BelowPages::class,
Template1FixedBar::ID => Template1FixedBar::class,
Template1Popup::ID => Template1Popup::class,
Template1SlideIn::ID => Template1SlideIn::class,
Template1Widget::ID => Template1Widget::class,
Template3BelowPages::ID => Template3BelowPages::class, Template3BelowPages::ID => Template3BelowPages::class,
Template3FixedBar::ID => Template3FixedBar::class, Template3FixedBar::ID => Template3FixedBar::class,
Template3Popup::ID => Template3Popup::class, Template3Popup::ID => Template3Popup::class,

View File

@ -0,0 +1,263 @@
<?php
namespace MailPoet\Form\Templates\Templates;
use MailPoet\Form\Templates\FormTemplate;
class Template1BelowPages extends FormTemplate {
const ID = 'template_1_below_pages';
public function getName(): string {
return 'Template 1 Below Pages';
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => _x('<img draggable="false" role="img" class="emoji" alt="🤞" src="https://s.w.org/images/core/emoji/13.0.0/svg/1f91e.svg"> <span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">Don\'t miss these tips!</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'level' => '1',
'align' => 'center',
'font_size' => '40',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '20',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => _x('<em><em><em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">We don\'t spam! Read more in our <a href="http://mailpoet.info/privacy-policy/">privacy policy</a>.</span></em></em></em>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '15',
'border_size' => '10',
'form_padding' => '10',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '20',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'classic',
'border_color' => '#f7f7f7',
'form_placement_bellow_posts_enabled' => '1',
'form_placement_popup_enabled' => '',
'form_placement_fixed_bar_enabled' => '',
'form_placement_slide_in_enabled' => '',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
form.mailpoet_form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}

View File

@ -0,0 +1,310 @@
<?php
namespace MailPoet\Form\Templates\Templates;
use MailPoet\Form\Templates\FormTemplate;
class Template1FixedBar extends FormTemplate {
const ID = 'template_1_fixed_bar';
public function getName(): string {
return 'Template 1 Fixed Bar';
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => _x('<img draggable="false" role="img" class="emoji" alt="🤞" src="https://s.w.org/images/core/emoji/13.0.0/svg/1f91e.svg"> <span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">Don\'t miss these tips!</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'level' => '1',
'align' => 'left',
'font_size' => '28',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => _x('<em><em><em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">We don\'t spam! Read more in our <a href="http://mailpoet.info/privacy-policy/">privacy policy</a>.</span></em></em></em>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'drop_cap' => '0',
'align' => 'left',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '12',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '10',
'form_padding' => '0',
'input_padding' => '12',
'background_image_display' => 'scale',
'fontSize' => '16',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'round_black',
'border_color' => '#f7f7f7',
'form_placement_bellow_posts_enabled' => '',
'form_placement_popup_enabled' => '',
'form_placement_fixed_bar_enabled' => '1',
'form_placement_slide_in_enabled' => '',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}

View File

@ -0,0 +1,242 @@
<?php
namespace MailPoet\Form\Templates\Templates;
use MailPoet\Form\Templates\FormTemplate;
class Template1Popup extends FormTemplate {
const ID = 'template_1_popup';
/** @var string */
protected $assetsDirectory = 'template-1';
public function getName(): string {
return 'Template 1 Popup';
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('Oval@3x-2-1024x570.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => 'http://mailpoet.info/oval3x-2/',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '244',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => _x('<span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">Don\'t miss these tips!</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'level' => '1',
'align' => 'center',
'font_size' => '40',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '24',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => _x('<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">We don\'t spam! Read more in our <a href="/privacy-policy/">privacy policy</a>.</span></em>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '360',
],
],
],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '16',
'border_size' => '0',
'form_padding' => '16',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '20',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'round_black',
'form_placement_bellow_posts_enabled' => '',
'form_placement_popup_enabled' => '1',
'form_placement_fixed_bar_enabled' => '',
'form_placement_slide_in_enabled' => '',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h1.mailpoet-heading {
margin: 0 0 20px;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}

View File

@ -0,0 +1,244 @@
<?php
namespace MailPoet\Form\Templates\Templates;
use MailPoet\Form\Templates\FormTemplate;
class Template1SlideIn extends FormTemplate {
const ID = 'template_1_slide_in';
/** @var string */
protected $assetsDirectory = 'template-1';
public function getName(): string {
return 'Template 1 Slide-in';
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('Oval@3x-2-1024x570.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => 'http://mailpoet.info/oval3x-2/',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '244',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => _x('<span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">Don\'t miss these tips!</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'level' => '1',
'align' => 'center',
'font_size' => '40',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '24',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => _x('<em><em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">We don\'t spam! Read more in our <a href="http://mailpoet.info/privacy-policy/">privacy policy</a>.</span></em></em>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'form_delay' => '0',
'form_position' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '360',
],
],
],
'others' => [],
],
'border_radius' => '16',
'border_size' => '0',
'form_padding' => '20',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '20',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'round_black',
'form_placement_bellow_posts_enabled' => '',
'form_placement_popup_enabled' => '',
'form_placement_fixed_bar_enabled' => '',
'form_placement_slide_in_enabled' => '1',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h1.mailpoet-heading {
margin: 0 0 20px;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}

View File

@ -0,0 +1,241 @@
<?php
namespace MailPoet\Form\Templates\Templates;
use MailPoet\Form\Templates\FormTemplate;
class Template1Widget extends FormTemplate {
const ID = 'template_1_widget';
/** @var string */
protected $assetsDirectory = 'template-1';
public function getName(): string {
return 'Template 1 Widget';
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('Oval@3x-2-1024x570.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => 'http://mailpoet.info/oval3x-2/',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '244',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => _x('<span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">Don\'t miss these tips!</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'level' => '1',
'align' => 'center',
'font_size' => '25',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '15',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => _x('<em><em><em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">We don\'t spam! Read more in our <a href="http://mailpoet.info/privacy-policy/">privacy policy</a>.</span></em></em></em>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '20',
'border_size' => '10',
'form_padding' => '10',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '15',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'classic',
'border_color' => '#f7f7f7',
'form_placement_bellow_posts_enabled' => '',
'form_placement_popup_enabled' => '',
'form_placement_fixed_bar_enabled' => '',
'form_placement_slide_in_enabled' => '',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h1.mailpoet-heading {
margin: 0 0 20px;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB