Closed TakiKio closed 7 years ago
Okay, I think the issue is that since 3.0.0, when installed with the zip download or Kirby’s CLI, the plugin is automatically registered. That’s the way most Kirby plugins work, including the Blade plugin.
See the install section:
https://github.com/fvsch/kirby-twig#installation
And the plugin’s main script:
https://github.com/fvsch/kirby-twig/blob/master/twig.php
You only have to use the Kirby\Twig\Plugin::register
method when installing the plugin with Composer.
The Blade plugin is doing roughly the same thing: https://github.com/pedroborges/kirby-blade-template/blob/master/blade.php
The reason that the Blade plugin doesn’t work with the Twig plugin also enabled is that you can only register one template component, and since plugins are loaded in alphabetical order, so this is what happens:
$kirby->set('component', 'template', PedroBorges\Blade\Template::class);
$kirby->set('component', 'template', 'Kirby\Twig\TwigComponent');
The second call overwrites the first one, so Blade is not used.
If you want to keep the Twig plugin around (in your site/plugins
folder) but disable it, you can edit site/plugins/twig/twig.php
to comment out the call to Kirby\Twig\Plugin::register
.
Alternatively, just rename that file to twig.php.disabled
and Kirby won’t load it.
I was trying both, twig and blade, first I downloaded twig and registered it as recommended. Then I switched over to blade because the page will maybe made in future time with laravel for some reasons. So I deregistered (commented out) twig in config file. But twig nevertheless caused Problems with blade. I had to remove the twig plugin for blade to work.