Skip to content

Commit

Permalink
Merge pull request #94 from Akollade/twig-node-yield
Browse files Browse the repository at this point in the history
Fix deprecation with Twig Node / yield
  • Loading branch information
notFloran authored Nov 21, 2024
2 parents afd34d5 + c3a26f7 commit 616c8a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Twig/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public function compile(Compiler $compiler): void
->write('$content = preg_replace(\'/^\' . $matches[0]. \'/\', "", $lines);'.PHP_EOL)
->write('$content = implode("\n", $content);'.PHP_EOL);

$compiler->write('echo $this->env->getExtension("'.Extension::class.'")->getMjml()->render($content);'.PHP_EOL);
if (class_exists(CaptureNode::class)) {
$compiler->write('yield $this->env->getExtension("'.Extension::class.'")->getMjml()->render($content);'.PHP_EOL);
} else {
$compiler->write('echo $this->env->getExtension("'.Extension::class.'")->getMjml()->render($content);'.PHP_EOL);
}
}
}

0 comments on commit 616c8a8

Please sign in to comment.