diff --git a/lib/DI/ContainerConfigurator.php b/lib/DI/ContainerConfigurator.php
index a65c6aed7c..24e0e9825a 100644
--- a/lib/DI/ContainerConfigurator.php
+++ b/lib/DI/ContainerConfigurator.php
@@ -172,6 +172,16 @@ class ContainerConfigurator implements IContainerConfigurator {
$container->autowire(\MailPoet\Form\FormsRepository::class);
$container->autowire(\MailPoet\Form\Renderer::class);
$container->autowire(\MailPoet\Form\BlocksRenderer::class);
+ $container->autowire(\MailPoet\Form\Block\Checkbox::class);
+ $container->autowire(\MailPoet\Form\Block\Date::class);
+ $container->autowire(\MailPoet\Form\Block\Divider::class);
+ $container->autowire(\MailPoet\Form\Block\Html::class);
+ $container->autowire(\MailPoet\Form\Block\Radio::class);
+ $container->autowire(\MailPoet\Form\Block\Segment::class);
+ $container->autowire(\MailPoet\Form\Block\Select::class);
+ $container->autowire(\MailPoet\Form\Block\Submit::class);
+ $container->autowire(\MailPoet\Form\Block\Text::class);
+ $container->autowire(\MailPoet\Form\Block\Textarea::class);
$container->autowire(\MailPoet\Form\Util\Styles::class);
// Helpscout
$container->autowire(\MailPoet\Helpscout\Beacon::class);
diff --git a/lib/Form/Block/Base.php b/lib/Form/Block/Base.php
index 2778848990..f838ccbaac 100644
--- a/lib/Form/Block/Base.php
+++ b/lib/Form/Block/Base.php
@@ -7,7 +7,7 @@ use MailPoet\Models\ModelValidator;
use MailPoet\WP\Functions as WPFunctions;
abstract class Base {
- protected static function getInputValidation($block, $extraRules = []) {
+ protected function getInputValidation($block, $extraRules = []) {
$rules = [];
if ($block['id'] === 'email') {
@@ -66,7 +66,7 @@ abstract class Base {
return join(' ', $validation);
}
- protected static function renderLabel($block) {
+ protected function renderLabel($block) {
$html = '';
if (
isset($block['params']['hide_label'])
@@ -94,7 +94,7 @@ abstract class Base {
return $html;
}
- protected static function renderInputPlaceholder($block) {
+ protected function renderInputPlaceholder($block) {
$html = '';
// if the label is displayed as a placeholder,
if (
@@ -114,7 +114,7 @@ abstract class Base {
}
// return field name depending on block data
- protected static function getFieldName($block = []) {
+ protected function getFieldName($block = []) {
if ((int)$block['id'] > 0) {
return 'cf_' . $block['id'];
} elseif (isset($block['params']['obfuscate']) && !$block['params']['obfuscate']) {
@@ -125,19 +125,19 @@ abstract class Base {
}
}
- protected static function getFieldLabel($block = []) {
+ protected function getFieldLabel($block = []) {
return (isset($block['params']['label'])
&& strlen(trim($block['params']['label'])) > 0)
? trim($block['params']['label']) : '';
}
- protected static function getFieldValue($block = []) {
+ protected function getFieldValue($block = []) {
return (isset($block['params']['value'])
&& strlen(trim($block['params']['value'])) > 0)
? WPFunctions::get()->escAttr(trim($block['params']['value'])) : '';
}
- protected static function getInputModifiers($block = []) {
+ protected function getInputModifiers($block = []) {
$modifiers = [];
if (isset($block['params']['readonly']) && $block['params']['readonly']) {
diff --git a/lib/Form/Block/Checkbox.php b/lib/Form/Block/Checkbox.php
index ae2347f6cc..1e53022cf8 100644
--- a/lib/Form/Block/Checkbox.php
+++ b/lib/Form/Block/Checkbox.php
@@ -4,15 +4,15 @@ namespace MailPoet\Form\Block;
class Checkbox extends Base {
- public static function render($block) {
+ public function render($block) {
$html = '';
- $fieldName = 'data[' . static::getFieldName($block) . ']';
- $fieldValidation = static::getInputValidation($block);
+ $fieldName = 'data[' . $this->getFieldName($block) . ']';
+ $fieldValidation = $this->getInputValidation($block);
$html .= '
';
- $html .= static::renderLabel($block);
+ $html .= $this->renderLabel($block);
$options = (!empty($block['params']['values'])
? $block['params']['values']
diff --git a/lib/Form/Block/Date.php b/lib/Form/Block/Date.php
index 24811550c6..aa02441cbf 100644
--- a/lib/Form/Block/Date.php
+++ b/lib/Form/Block/Date.php
@@ -7,22 +7,22 @@ use MailPoetVendor\Carbon\Carbon;
class Date extends Base {
- public static function render($block) {
+ public function render($block) {
$html = '';
$html .= '
';
- $html .= static::renderLabel($block);
- $html .= static::renderDateSelect($block);
+ $html .= $this->renderLabel($block);
+ $html .= $this->renderDateSelect($block);
$html .= '
';
return $html;
}
- private static function renderDateSelect($block = []) {
+ private function renderDateSelect($block = []) {
$html = '';
- $fieldName = 'data[' . static::getFieldName($block) . ']';
+ $fieldName = 'data[' . $this->getFieldName($block) . ']';
- $dateFormats = static::getDateFormats();
+ $dateFormats = $this->getDateFormats();
// automatically select first date format
$dateFormat = $dateFormats[$block['params']['date_type']][0];
@@ -39,27 +39,27 @@ class Date extends Base {
foreach ($dateSelectors as $dateSelector) {
if ($dateSelector === 'DD') {
$html .= '';
} else if ($dateSelector === 'MM') {
$html .= '';
} else if ($dateSelector === 'YYYY') {
$html .= '';
}
}
@@ -69,7 +69,7 @@ class Date extends Base {
return $html;
}
- public static function getDateTypes() {
+ public function getDateTypes() {
return [
'year_month_day' => WPFunctions::get()->__('Year, month, day', 'mailpoet'),
'year_month' => WPFunctions::get()->__('Year, month', 'mailpoet'),
@@ -78,7 +78,7 @@ class Date extends Base {
];
}
- public static function getDateFormats() {
+ public function getDateFormats() {
return [
'year_month_day' => ['MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD'],
'year_month' => ['MM/YYYY', 'YYYY/MM'],
@@ -86,14 +86,14 @@ class Date extends Base {
'month' => ['MM'],
];
}
- public static function getMonthNames() {
+ public function getMonthNames() {
return [__('January', 'mailpoet'), WPFunctions::get()->__('February', 'mailpoet'), WPFunctions::get()->__('March', 'mailpoet'), WPFunctions::get()->__('April', 'mailpoet'),
WPFunctions::get()->__('May', 'mailpoet'), WPFunctions::get()->__('June', 'mailpoet'), WPFunctions::get()->__('July', 'mailpoet'), WPFunctions::get()->__('August', 'mailpoet'), WPFunctions::get()->__('September', 'mailpoet'),
WPFunctions::get()->__('October', 'mailpoet'), WPFunctions::get()->__('November', 'mailpoet'), WPFunctions::get()->__('December', 'mailpoet'),
];
}
- public static function getMonths($block = []) {
+ private function getMonths($block = []) {
$defaults = [
'selected' => null,
];
@@ -105,7 +105,7 @@ class Date extends Base {
// merge block with defaults
$block = array_merge($defaults, $block);
- $monthNames = static::getMonthNames();
+ $monthNames = $this->getMonthNames();
$html = '';
@@ -122,7 +122,7 @@ class Date extends Base {
return $html;
}
- public static function getYears($block = []) {
+ private function getYears($block = []) {
$defaults = [
'selected' => null,
'from' => (int)strftime('%Y') - 100,
@@ -151,7 +151,7 @@ class Date extends Base {
return $html;
}
- public static function getDays($block = []) {
+ private function getDays($block = []) {
$defaults = [
'selected' => null,
];
@@ -177,7 +177,7 @@ class Date extends Base {
return $html;
}
- public static function convertDateToDatetime($date, $dateFormat) {
+ public function convertDateToDatetime($date, $dateFormat) {
$datetime = false;
if ($dateFormat === 'datetime') {
$datetime = $date;
diff --git a/lib/Form/Block/Divider.php b/lib/Form/Block/Divider.php
index f3605ddf1f..a5e3f35fc2 100644
--- a/lib/Form/Block/Divider.php
+++ b/lib/Form/Block/Divider.php
@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Divider {
- public static function render() {
+ public function render() {
return '
';
}
-}
\ No newline at end of file
+}
diff --git a/lib/Form/Block/Html.php b/lib/Form/Block/Html.php
index 7710e7926a..d0a8146362 100644
--- a/lib/Form/Block/Html.php
+++ b/lib/Form/Block/Html.php
@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Html {
- public static function render($block) {
+ public function render($block) {
$html = '';
$text = '';
diff --git a/lib/Form/Block/Radio.php b/lib/Form/Block/Radio.php
index 5935fa1401..230812b247 100644
--- a/lib/Form/Block/Radio.php
+++ b/lib/Form/Block/Radio.php
@@ -4,22 +4,22 @@ namespace MailPoet\Form\Block;
class Radio extends Base {
- public static function render($block) {
+ public function render($block) {
$html = '';
- $fieldName = 'data[' . static::getFieldName($block) . ']';
- $fieldValidation = static::getInputValidation($block);
+ $fieldName = 'data[' . $this->getFieldName($block) . ']';
+ $fieldValidation = $this->getInputValidation($block);
$html .= '';
- $html .= static::renderLabel($block);
+ $html .= $this->renderLabel($block);
$options = (!empty($block['params']['values'])
? $block['params']['values']
: []
);
- $selectedValue = self::getFieldValue($block);
+ $selectedValue = $this->getFieldValue($block);
foreach ($options as $option) {
$html .= '