HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Adding a custom path to Twig

Hello, I need help:

How can I change or add a new path to twig?



  • I changed line `66` of the file library/Vanilla/Web/TwigRenderTrait.php to the correct diretory.

    A did so to solve (to patch) a bug I had, as exposed here https://open.vanillaforums.com/discussion/37561/upgrading-from-3-1-to-3-2-fatal-error-in-twig-loader-filesystemloader-findtemplate

     61   public function renderTwig(string $path, array $data): string {
     62     if (!$this->twig) {
     63       $this->twig = $this->prepareTwig();
     64     }
     65     // Ensure that we don't duplicate our root path in the path view.
     66     $path = str_replace('/home/user/VANILLA-FILES', '', $path);
     67     return $this->twig->render($path, $data);

    If there is better way to do this please tell me :)

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... Moderator

    @kassius If you could raise this as an issue on GitHub, it would get to the attention of the developers.

Sign In or Register to comment.