Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation #27

Open
hiboudev opened this issue Jul 2, 2023 · 2 comments
Open

Update documentation #27

hiboudev opened this issue Jul 2, 2023 · 2 comments

Comments

@hiboudev
Copy link
Contributor

hiboudev commented Jul 2, 2023

On this page: https://processwire.com/modules/template-engine-twig/

  • Current version is v3, not v2.

  • This code is wrong:

wire()->addHookAfter('TemplateEngineTwig::initTwig', function (HookEvent $event) {
    /** @var \Twig_Environment $twig */
    $twig = $event->arguments('twig');
    $twig->addFunction(new \Twig_Function('processwire', function () {
        return 'ProcessWire rocks!';
    }));
});

This one is OK:

wire()->addHookAfter('TemplateEngineTwig::initTwig', function (HookEvent $event) {
    /** @var \Twig\Environment $twig */
    $twig = $event->arguments('twig');
    $twig->addFunction(new \Twig\TwigFunction('processwire', function () {
        return 'ProcessWire rocks!';
    }));
});
@wanze
Copy link
Owner

wanze commented Jul 31, 2023

Oh, the module still displays an outdated version of the README of this repo (https://github.com/wanze/TemplateEngineTwig). It's correct there. Just can't login atm on ProcessWire, I thought that it should sync the readme automatically there?

@hiboudev
Copy link
Contributor Author

hiboudev commented Aug 2, 2023

I have no idea how it should work. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants