Created
October 25, 2018 17:48
-
-
Save herveguetin/11ba88901e20ccd3c730f2515907a724 to your computer and use it in GitHub Desktop.
Directive interpolation in Magento 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeClass | |
{ | |
public function __construct( | |
\Magento\Framework\Filter\Template $templateFilter | |
) | |
{ | |
$this->templateFilter = $templateFilter; | |
} | |
public function getDirectiveContent() | |
{ | |
return $this->templateFilter | |
->setVariables(['who' => 'World']) | |
->filter('Hello {{var who}}'); | |
// Hello World | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment