Update admin.php (#1409)

Fix for https://github.com/getgrav/grav-plugin-admin/issues/1408
This commit is contained in:
Ante Drnasin
2018-04-02 14:38:33 +02:00
committed by Andy Miller
parent acb1e33a04
commit 7025f2fa2b

View File

@@ -792,11 +792,13 @@ class AdminPlugin extends Plugin
{
// Special case to redirect after changing the admin route to avoid 'breaking'
$obj = $event['object'];
$blueprint = $obj->blueprints()->getFilename();
if (!is_null($event['object'])) {
$blueprint = $obj->blueprints()->getFilename();
if ($blueprint == 'admin/blueprints' && isset($obj->route) && $this->admin_route !== $obj->route) {
$redirect = preg_replace('/^' . str_replace('/','\/',$this->admin_route) . '/',$obj->route,$this->uri->path());
$this->grav->redirect($redirect);
if ($blueprint == 'admin/blueprints' && isset($obj->route) && $this->admin_route !== $obj->route) {
$redirect = preg_replace('/^' . str_replace('/','\/',$this->admin_route) . '/',$obj->route,$this->uri->path());
$this->grav->redirect($redirect);
}
}
}