@@ -119,14 +119,24 @@ public function getFrontName($checkHost = false)
119119 *
120120 * @return bool
121121 */
122- public function isHostBackend (): bool
122+ public function isHostBackend ()
123123 {
124124 if (!$ this ->request ->getServer ('HTTP_HOST ' )) {
125125 return false ;
126126 }
127127
128- $ backendUrl = $ this ->getBackendUrl ();
129-
128+ if ($ this ->scopeConfig ->getValue (self ::XML_PATH_USE_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE )) {
129+ $ backendUrl = $ this ->scopeConfig ->getValue (self ::XML_PATH_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE );
130+ } else {
131+ $ xmlPath = $ this ->request ->isSecure () ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL ;
132+ $ backendUrl = $ this ->config ->getValue ($ xmlPath );
133+ if ($ backendUrl === null ) {
134+ $ backendUrl = $ this ->scopeConfig ->getValue (
135+ $ xmlPath ,
136+ ScopeInterface::SCOPE_STORE
137+ );
138+ }
139+ }
130140 $ this ->uri ->parse ($ backendUrl );
131141 $ configuredHost = $ this ->uri ->getHost ();
132142 if (!$ configuredHost ) {
@@ -144,20 +154,4 @@ public function isHostBackend(): bool
144154
145155 return strcasecmp ($ configuredHost , $ host ) === 0 ;
146156 }
147-
148- /**
149- * Retrieve backend URL
150- * @return string|null
151- */
152- private function getBackendUrl (): ?string
153- {
154- if ($ this ->scopeConfig ->getValue (self ::XML_PATH_USE_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE )) {
155- return $ this ->scopeConfig ->getValue (self ::XML_PATH_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE );
156- }
157-
158- $ xmlPath = $ this ->request ->isSecure () ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL ;
159- $ backendUrl = $ this ->config ->getValue ($ xmlPath );
160- return $ backendUrl ?? $ this ->scopeConfig ->getValue ($ xmlPath , ScopeInterface::SCOPE_STORE );
161- }
162-
163157}
0 commit comments