deploymentConfig->get('backend/frontName', 'admin'); } /** * True when the request path contains the configured admin front name as a segment (any position), * after skipping empty, index.php, and pub segments. */ public function isAdminPath(Http $request): bool { return $this->getAdminFrontNameIfPresentInPath($request) !== null; } public function getAdminFrontNameIfPresentInPath(Http $request): ?string { $path = trim((string) $request->getPathInfo(), '/'); if ($path === '') { $uriPath = parse_url((string) $request->getRequestUri(), PHP_URL_PATH); $path = trim((string) $uriPath, '/'); } if ($path === '') { return null; } $adminFront = $this->getConfiguredAdminFrontName(); foreach (explode('/', $path) as $segment) { $lower = strtolower($segment); if ($lower === '' || $lower === 'index.php' || $lower === 'pub') { continue; } if (strcasecmp($segment, $adminFront) === 0) { return $adminFront; } } return null; } }