Skip to content

Commit

Permalink
Added maintenance link
Browse files Browse the repository at this point in the history
  • Loading branch information
L3RAZ committed Aug 1, 2023
1 parent 95bd5fa commit 57a9578
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/Adapter/LinkAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,19 @@ public function getAdminLink($controller, $withToken = true, $sfRouteParams = []
$shop = \Context::getContext()->shop;

if ((new ShopContext())->isShop17()) {
$link = $this->link->getAdminLink($controller, $withToken, $sfRouteParams, $params);
$adminLink = $this->link->getAdminLink($controller, $withToken, $sfRouteParams, $params);

return $shop->virtual_uri !== '' ? str_replace($shop->physical_uri . $shop->virtual_uri, $shop->physical_uri, $link) : $link;
if ($shop->virtual_uri !== '') {
$adminLink = str_replace($shop->physical_uri . $shop->virtual_uri, $shop->physical_uri, $adminLink);
}

// We have problems with links in our zoid application, since some links generated don't have domain they redirect to CDN domain
// Routes that use new symfony router are returned without the domain
if (strpos($adminLink, 'http') !== 0) {
return \Tools::getShopDomainSsl(true) . $adminLink;
}

return $adminLink;
}

$paramsAsString = '';
Expand Down
3 changes: 2 additions & 1 deletion src/Presenter/Store/Modules/ContextModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function present()
'shopsTree' => $this->getShopsTree(),
'faq' => $this->getFaq(),
'language' => $this->psContext->getLanguage(),
'prestashopCheckoutAjax' => (new LinkAdapter($this->psContext->getLink()))->getAdminLink('AdminAjaxPrestashopCheckout'),
'prestashopCheckoutAjax' => $this->getGeneratedLink('AdminAjaxPrestashopCheckout'),
'translations' => $this->translations->getTranslations(),
'readmeUrl' => $this->getReadme(),
'cguUrl' => $this->getCgu(),
Expand All @@ -170,6 +170,7 @@ public function present()
'countriesLink' => $this->getGeneratedLink('AdminCountries'),
'currenciesLink' => $this->getGeneratedLink('AdminCurrencies'),
'paymentPreferencesLink' => $this->getGeneratedLink($this->shopContext->isShop17() ? 'AdminPaymentPreferences' : 'AdminPayment'),
'maintenanceLink' => $this->getGeneratedLink('AdminMaintenance'),
'overridesExist' => $this->overridesExist(),
'submitIdeaLink' => $this->getSubmitIdeaLink(),
'orderTotal' => (new OrderRepository())->count($this->psContext->getShopId()),
Expand Down

0 comments on commit 57a9578

Please sign in to comment.