The following error is reported enabling the theme in latest D8-RC, making the theme unusable.

Twig_Sandbox_SecurityError: Calling "setOptions" method on a "Drupal\Core\Url" object is not allowed in "themes/bear_skin/templates/html.html.twig" at line 28. in Drupal\Core\Template\TwigSandboxPolicy->checkMethodAllowed() (line 101 of /web/htdocs/www.taoartconsulting.com/home/core/lib/Drupal/Core/Template/TwigSandboxP...).

Comments

Norberto Ostallo created an issue. See original summary.

darol100’s picture

I'm porting light_skeleton and I ran into this problem when I try to use RC4. I started the development on RC2 and it was working fine.

In my case it was due to this line - {{ link(item.title, item.url.setOptions({'set_active_class' : TRUE, 'attributes' : {'class' : 'navbar-link'}})) }}. I have not been able to figure out how to fixed it, but I open a question in Drupal Stack Exchange - http://drupal.stackexchange.com/questions/180919/twig-sandbox-securityer...

Fixing this issue is going to benefit both projects. I will keep you update if I figure out the problem on my light_skeleton project.

darol100’s picture

Here is some extra information
The actual problem is on menu--main.html.twig, where the theme is using multiples "setOptions" and this is why is giving you the WSOD and the security error. We need to find a way to achieve this without using "setOptions", we might be able to do it with a "if" statement, but it some hacky to me.

I think we should investigate if there is a better way to do this in Twig (i think).

alioso’s picture

Status: Active » Needs review

Hey daeol100, thanks for reporting. Yeah, I had developed with rc2 when that was not a problem. What I ended up doing is a complete rewrite for the twig template. It was actually rather ugly, so this will work much better: https://github.com/zivtech/bear_skin/blob/3adfe45dfe4d9f49724fc609ef88a1...

Release in the latest 8.x-1.4

darol100’s picture

@alioso, I will take a look at your changes, and review your changes in couple days.

Feel free to try on fix on the same issue on Light Skeleton #2617288: Light Skeleton - Twig_Sandbox_SecurityError .

alioso’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.