From 1e458ef03d5e0e330ce99ca3df523d15a22d443e Mon Sep 17 00:00:00 2001 From: DorsetDigital Date: Wed, 17 Oct 2018 23:20:20 +0100 Subject: [PATCH] Change source of admin URL in getIsAdmin() As per #394 Change direct call to the AdminRootController config setting, using instead the admin_url() method on the class which provides detection via the Director rules, and the fallback to the config setting. --- src/Middleware/InitStateMiddleware.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Middleware/InitStateMiddleware.php b/src/Middleware/InitStateMiddleware.php index b5abf0c..abec0ff 100644 --- a/src/Middleware/InitStateMiddleware.php +++ b/src/Middleware/InitStateMiddleware.php @@ -62,7 +62,7 @@ class InitStateMiddleware implements HTTPMiddleware public function getIsAdmin(HTTPRequest $request) { $adminPaths = static::config()->get('admin_url_paths'); - $adminPaths[] = AdminRootController::config()->get('url_base') . '/'; + $adminPaths[] = AdminRootController::admin_url(); $currentPath = rtrim($request->getURL(), '/') . '/'; foreach ($adminPaths as $adminPath) { if (substr($currentPath, 0, strlen($adminPath)) === $adminPath) {