mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-07 03:36:30 +02:00
Initialize dynamic page forms properly
This commit is contained in:
@@ -466,6 +466,7 @@ class AdminPlugin extends Plugin
|
||||
public function onTwigSiteVariables()
|
||||
{
|
||||
$twig = $this->grav['twig'];
|
||||
$page = $this->grav['page'];
|
||||
|
||||
$twig->twig_vars['location'] = $this->template;
|
||||
$twig->twig_vars['base_url_relative_frontend'] = $twig->twig_vars['base_url_relative'] ?: '/';
|
||||
@@ -479,6 +480,12 @@ class AdminPlugin extends Plugin
|
||||
$twig->twig_vars['admin'] = $this->admin;
|
||||
$twig->twig_vars['admin_version'] = $this->version;
|
||||
|
||||
// add form if it exists in the page
|
||||
$header = $page->header();
|
||||
if (isset($header->form)) {
|
||||
$twig->twig_vars['form'] = new Form($page);
|
||||
}
|
||||
|
||||
// Gather Plugin-hooked nav items
|
||||
$this->grav->fireEvent('onAdminMenu');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user