Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Directive interpolation in Magento 2
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