mirror of
https://github.com/saccas/mjml-typo3.git
synced 2024-11-22 23:16:10 +01:00
Daniel Siepmann
eba401aa9f
Add all dependencies to run tests. Configure tests as composer task. Add tests to travis. Adjust code to make him exchangeable and testable.
29 lines
786 B
PHP
29 lines
786 B
PHP
<?php
|
|
namespace Saccas\Mjml\View;
|
|
|
|
use Saccas\Mjml\Domain\Renderer\RendererInterface;
|
|
use TYPO3\CMS\Fluid\View\StandaloneView;
|
|
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
|
|
|
class MjmlBasedView extends StandaloneView
|
|
{
|
|
/**
|
|
* @var RendererInterface
|
|
*/
|
|
protected $renderer;
|
|
|
|
public function __construct(ContentObjectRenderer $contentObject = null, RendererInterface $renderer = null)
|
|
{
|
|
parent::__construct($contentObject);
|
|
|
|
$this->renderer = $renderer;
|
|
if ($this->renderer === null) {
|
|
$this->renderer = $this->objectManager->get(RendererInterface::class);
|
|
}
|
|
}
|
|
|
|
public function render($actionName = null)
|
|
{
|
|
return $this->renderer->getHtmlFromMjml(parent::render($actionName));
|
|
}
|
|
}
|