mirror of
https://github.com/saccas/mjml-typo3.git
synced 2024-11-22 11:36:11 +01:00
[BUGFIX] Add default folder configs and missing extbase registration
This commit is contained in:
parent
1fef314213
commit
543fbba727
3 changed files with 19 additions and 7 deletions
|
@ -3,6 +3,7 @@ namespace Saccas\Mjml\Domain\Renderer;
|
||||||
|
|
||||||
use TYPO3\CMS\Core\Utility\CommandUtility;
|
use TYPO3\CMS\Core\Utility\CommandUtility;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
|
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
|
||||||
|
|
||||||
class Command implements RendererInterface
|
class Command implements RendererInterface
|
||||||
{
|
{
|
||||||
|
@ -15,11 +16,12 @@ class Command implements RendererInterface
|
||||||
GeneralUtility::writeFileToTypo3tempDir($temporaryMjmlFileWithPath, $mjml);
|
GeneralUtility::writeFileToTypo3tempDir($temporaryMjmlFileWithPath, $mjml);
|
||||||
|
|
||||||
// see https://mjml.io/download and https://www.npmjs.com/package/mjml-cli
|
// 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;
|
$args = $configuration['mjmlParams'] . ' ' . $temporaryMjmlFileWithPath;
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
$returnValue = '';
|
$returnValue = '';
|
||||||
|
|
||||||
CommandUtility::exec($this->getEscapedCommand($cmd, $args), $result, $returnValue);
|
CommandUtility::exec($this->getEscapedCommand($cmd, $args), $result, $returnValue);
|
||||||
|
|
||||||
GeneralUtility::unlink_tempfile($temporaryMjmlFileWithPath);
|
GeneralUtility::unlink_tempfile($temporaryMjmlFileWithPath);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# cat=node/Binary/1000; type=string; label=Path to node binary
|
# cat=node/Binary/1000; type=string; label=Path to node binary : /usr/bin/node
|
||||||
nodeBinaryPath = /usr/local/bin/node
|
nodeBinaryPath = /usr/bin/node
|
||||||
|
|
||||||
# cat=mjml/Binary/2000; type=string; label=Path to mjml binary
|
# cat=mjml/Binary/2000; type=string; label=Path to mjml binary in mjml EXT folder : ./node_modules/.bin/
|
||||||
mjmlBinaryPath = ../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
|
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
|
mjmlParams = -s -m
|
||||||
|
|
10
ext_localconf.php
Normal file
10
ext_localconf.php
Normal 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
|
||||||
|
);
|
Loading…
Reference in a new issue