urlBuilder = $urlBuilder; $this->storeManager = $storeManager; $this->scopeConfig = $scopeConfig; $this->customerUrl = $customerUrl ?? ObjectManager::getInstance() ->get(Url::class); } /** * {@inheritdoc} */ public function getConfig() { return [ 'customerLoginUrl' => $this->getLoginUrl(), 'isRedirectRequired' => $this->isRedirectRequired(), 'autocomplete' => $this->isAutocompleteEnabled(), ]; } /** * Is autocomplete enabled for storefront * * @return string * @codeCoverageIgnore */ protected function isAutocompleteEnabled() { return $this->scopeConfig->getValue( Form::XML_PATH_ENABLE_AUTOCOMPLETE, ScopeInterface::SCOPE_STORE ) ? 'on' : 'off'; } /** * Returns URL to login controller action * * @return string */ protected function getLoginUrl() { return $this->customerUrl->getLoginUrl(); } /** * Whether redirect to login page is required * * @return bool */ protected function isRedirectRequired() { $baseUrl = $this->storeManager->getStore()->getBaseUrl(); if (strpos($this->getLoginUrl(), $baseUrl) !== false) { return false; } return true; } }