I have found quite a few discussions on this but I can't seem to make it work. I define the variable in php this way
$theme_name = 'layout1';
So I tried the following to get 'layout1' to show in my CMS template using {{ theme.name }} by each one of the following, one at a time, but none of them worked. The ones with $twig gave undefined variable 'twig'.
$theme['name'] = $theme_name;
$app["twig"]->addGlobal("name", $theme_name);
$GLOBALS['theme'] = 'layout1';
$twig->addGlobal('themename', 'layout1');
So where am I going wrong?