public function onTwigSiteVariables()
{
$twig = $this->grav['twig'];
$twig->twig_vars['location'] = $this->template;
$twig->twig_vars['base_url_relative_frontend'] = $twig->twig_vars['base_url_relative'] ?: '/';
$twig->twig_vars['admin_route'] = trim($this->admin_route, '/');
$twig->twig_vars['base_url_relative'] = $twig->twig_vars['base_url_simple'] . '/' . $twig->twig_vars['admin_route'];
$theme_url = '/' . ltrim($this->grav['locator']->findResource('plugin://admin/themes/' . $this->theme, false), '/');
$twig->twig_vars['theme_url'] = $theme_url;
$twig->twig_vars['base_url'] = $twig->twig_vars['base_url_relative'];
$twig->twig_vars['base_path'] = GRAV_ROOT;
$twig->twig_vars['admin'] = $this->admin;
$twig->twig_vars['admin_version'] = $this->version;
// Gather Plugin-hooked nav items
$this->grav->fireEvent('onAdminMenu');
switch ($this->template) {
case 'dashboard':
$twig->twig_vars['popularity'] = $this->popularity;
// Gather Plugin-hooked dashboard items
$this->grav->fireEvent('onAdminDashboard');
break;
}
}