Skip to content

Commit

Permalink
Implementing SignalSlotDispatcher after a file is parsed (#52)
Browse files Browse the repository at this point in the history
* [TASK] implementing SignalSlotDispatcher after getting fileContent in AbstractParser Class

* [TASK] adding constant for SignalSlotDispatcher
  • Loading branch information
baschte authored and kaystrobach committed Jan 5, 2018
1 parent 2d8dd13 commit 762659e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions Classes/Parser/AbstractParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/
abstract class AbstractParser implements ParserInterface
{
const SIGNAL_DYNCSS_AFTER_FILE_PARSED = 'afterFileParsed';

/**
* @var array
*/
Expand All @@ -36,9 +38,19 @@ abstract class AbstractParser implements ParserInterface
*/
protected $config = [];

/**
* @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
*/
protected $signalSlotDispatcher;


public function __construct()
{
$this->initEmConfiguration();

// ObjectManager => get SignalSlotDispatcher
$objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
$this->signalSlotDispatcher = $objectManager->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
}

/**
Expand Down Expand Up @@ -290,6 +302,9 @@ public function compileFile($inputFilename, $outputFilename = null)

$fileContent = $this->_postCompile($this->_compileFile($inputFilename, $preparedFilename, $outputFilename, $cacheFilename));

// dispatch signal
$fileContent = $this->signalSlotDispatcher->dispatch(__CLASS__, self::SIGNAL_DYNCSS_AFTER_FILE_PARSED, [$fileContent]);

if ($fileContent !== false) {
file_put_contents($outputFilename, $fileContent);
// important for some cache clearing scenarios
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'description' => 'Compile your CSS dynamically with DynCss Adapters.',
'category' => 'fe',
'shy' => 0,
'version' => '0.8.2',
'version' => '0.8.3',
'dependencies' => '',
'conflicts' => '',
'priority' => '',
Expand Down

0 comments on commit 762659e

Please sign in to comment.