[BUGFIX] Add default folder configs and missing extbase registration

This commit is contained in:
Daniel Huf 2018-01-19 16:08:14 +01:00
parent 1fef314213
commit 543fbba727
3 changed files with 19 additions and 7 deletions

View file

@ -3,6 +3,7 @@ namespace Saccas\Mjml\Domain\Renderer;
use TYPO3\CMS\Core\Utility\CommandUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
class Command implements RendererInterface
{
@ -15,11 +16,12 @@ class Command implements RendererInterface
GeneralUtility::writeFileToTypo3tempDir($temporaryMjmlFileWithPath, $mjml);
// see https://mjml.io/download and https://www.npmjs.com/package/mjml-cli
$cmd = $configuration['nodeBinaryPath'] . ' ' . $configuration['mjmlBinaryPath'] . $configuration['mjmlBinary'];
$cmd = $configuration['nodeBinaryPath'] . ' ' . ExtensionManagementUtility::extPath('mjml') . $configuration['mjmlBinaryPath'] . $configuration['mjmlBinary'];
$args = $configuration['mjmlParams'] . ' ' . $temporaryMjmlFileWithPath;
$result = [];
$returnValue = '';
CommandUtility::exec($this->getEscapedCommand($cmd, $args), $result, $returnValue);
GeneralUtility::unlink_tempfile($temporaryMjmlFileWithPath);

View file

@ -1,11 +1,11 @@
# cat=node/Binary/1000; type=string; label=Path to node binary
nodeBinaryPath = /usr/local/bin/node
# cat=node/Binary/1000; type=string; label=Path to node binary : /usr/bin/node
nodeBinaryPath = /usr/bin/node
# cat=mjml/Binary/2000; type=string; label=Path to mjml binary
mjmlBinaryPath = ../node_modules/.bin/
# cat=mjml/Binary/2000; type=string; label=Path to mjml binary in mjml EXT folder : ./node_modules/.bin/
mjmlBinaryPath = ./node_modules/.bin/
# cat=mjml/Binary/3000; type=string; label=mjml binary
# cat=mjml/Binary/3000; type=string; label=mjml binary : mjml
mjmlBinary = mjml
# cat=mjml/Binary/4000; type=string; label=mjml params
# cat=mjml/Binary/4000; type=string; label=mjml params : -s -m
mjmlParams = -s -m

10
ext_localconf.php Normal file
View file

@ -0,0 +1,10 @@
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class)->registerImplementation(
\Saccas\Mjml\Domain\Renderer\RendererInterface::class,
\Saccas\Mjml\Domain\Renderer\Command::class
);