Refactor getBlocks and getBlock methods from static to instance methods

[MAILPOET-2665]
This commit is contained in:
Rostislav Wolny
2020-01-29 16:02:34 +01:00
committed by Jack Kitterhing
parent 37423908d7
commit 5193d4641c
3 changed files with 23 additions and 8 deletions

View File

@@ -20,7 +20,7 @@ class Renderer {
public function renderHTML($form = []) {
if (isset($form['body']) && !empty($form['body'])) {
return static::renderBlocks($form['body']);
return $this->renderBlocks($form['body']);
}
return '';
}
@@ -35,7 +35,7 @@ class Renderer {
}
}
public static function renderBlocks($blocks = [], $honeypotEnabled = true) {
public function renderBlocks($blocks = [], $honeypotEnabled = true) {
$settings = SettingsController::getInstance();
// add honeypot for spambots
$html = ($honeypotEnabled) ?
@@ -63,13 +63,13 @@ class Renderer {
<input class="mailpoet_recaptcha_field" type="hidden" name="recaptcha">
</div>';
}
$html .= static::renderBlock($block) . PHP_EOL;
$html .= $this->renderBlock($block) . PHP_EOL;
}
return $html;
}
private static function renderBlock($block = []) {
private function renderBlock($block = []) {
$html = '';
switch ($block['type']) {
case 'html':