As you know, we use this library as base for our TYPO3 handlebars extension. While this works quite well (thanks again for all your efforts! ❤️), we repeatedly run into a limitation with the current implementation.
It's quite common in TYPO3 to pass objects to templates and later access properties and/or methods. Imagine something like this:
final readonly class Foo
{
public function __construct(
public string $bar,
private string $boo = '',
) {}
public function getBoo(): string
{
return $this->boo;
}
}
$foo = new Foo('bar');
$template = <<<HBS
Bar: {{foo.bar}}
Boo: {{foo.boo}}
HBS;
$template = \DevTheorem\Handlebars\Handlebars::compile($template);
$result = $template(['foo' => $foo]);
In this particular example, we cannot access neither the bar property nor the boo property (through getBoo method). I understand that this contradicts the original Handlebars.js implementation and I don't ask for an explicit support for this specific use-case. But do you see any possibilities in providing a dedicated hook (or similar) in order for us to provide a specific implementation for lookups (as addition to the existing Runtime::lookupValue method)?
As you know, we use this library as base for our TYPO3
handlebarsextension. While this works quite well (thanks again for all your efforts! ❤️), we repeatedly run into a limitation with the current implementation.It's quite common in TYPO3 to pass objects to templates and later access properties and/or methods. Imagine something like this:
In this particular example, we cannot access neither the
barproperty nor thebooproperty (throughgetBoomethod). I understand that this contradicts the original Handlebars.js implementation and I don't ask for an explicit support for this specific use-case. But do you see any possibilities in providing a dedicated hook (or similar) in order for us to provide a specific implementation for lookups (as addition to the existingRuntime::lookupValuemethod)?