I can't get $this->grav['twig']->twig_vars() to work. (I can't even find the function in Grav API documentation).
I have tried to duplicate code in the login and form plugins.
I want to create a protect variable $myvar in a plugin class. Then I want to update $myvar in a custom form, eg., $this->myvar['operator'] = $data['operator'] (inside onFormProcessed(). This all works as expected and I can see $myvar in a debugger bar after dumping it.
Now I want to render the new value in twig, eg., in default.md I have the content line {{ myvar.operator }}
So I thought if I put the following in onTwigSiteVariables:
$this->myvar['operator'] = 'Some name';
$this->grav['twig']->twig_vars('myvar') = $this->myvar;
However, I am not seeing anything rendered by twig. I have twig processing on for pages. I have tried to put {{ myvar.operator }} in a template.
What am I missing?