Skip to content

Commit 1d48ea2

Browse files
committed
Merge remote-tracking branch 'origin/AC-13628' into spartans_pr_11022025
2 parents d253a44 + e8e5ef0 commit 1d48ea2

File tree

4 files changed

+47
-9
lines changed

4 files changed

+47
-9
lines changed

app/code/Magento/LoginAsCustomerFrontendUi/ViewModel/Configuration.php

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -12,6 +12,8 @@
1212
use Magento\Framework\App\ObjectManager;
1313
use Magento\LoginAsCustomerApi\Api\ConfigInterface;
1414
use Magento\LoginAsCustomerApi\Api\GetLoggedAsCustomerAdminIdInterface;
15+
use Magento\Framework\App\Config\ScopeConfigInterface;
16+
use Magento\Store\Model\StoreManagerInterface;
1517

1618
/**
1719
* View model to get extension configuration in the template
@@ -33,20 +35,36 @@ class Configuration implements \Magento\Framework\View\Element\Block\ArgumentInt
3335
*/
3436
private $getLoggedAsCustomerAdminId;
3537

38+
/**
39+
* @var ScopeConfigInterface
40+
*/
41+
private $scopeConfig;
42+
43+
/**
44+
* @var StoreManagerInterface
45+
*/
46+
private $storeManager;
47+
3648
/**
3749
* @param ConfigInterface $config
3850
* @param HttpContext $httpContext
51+
* @param ScopeConfigInterface $scopeConfig
52+
* @param StoreManagerInterface $storeManager
3953
* @param GetLoggedAsCustomerAdminIdInterface $getLoggedAsCustomerAdminId
4054
*/
4155
public function __construct(
4256
ConfigInterface $config,
4357
HttpContext $httpContext,
58+
ScopeConfigInterface $scopeConfig,
59+
StoreManagerInterface $storeManager,
4460
?GetLoggedAsCustomerAdminIdInterface $getLoggedAsCustomerAdminId = null
4561
) {
4662
$this->config = $config;
4763
$this->httpContext = $httpContext;
4864
$this->getLoggedAsCustomerAdminId = $getLoggedAsCustomerAdminId
4965
?? ObjectManager::getInstance()->get(GetLoggedAsCustomerAdminIdInterface::class);
66+
$this->scopeConfig = $scopeConfig;
67+
$this->storeManager = $storeManager;
5068
}
5169

5270
/**
@@ -68,4 +86,19 @@ private function isLoggedIn(): bool
6886
{
6987
return (bool)$this->httpContext->getValue(Context::CONTEXT_AUTH);
7088
}
89+
90+
/**
91+
* Is B2b enabled
92+
*
93+
* @return bool
94+
* @throws \Magento\Framework\Exception\NoSuchEntityException
95+
*/
96+
public function isB2bEnabled(): bool
97+
{
98+
return (bool)$this->scopeConfig->getValue(
99+
"btob/website_configuration/company_active",
100+
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE,
101+
$this->storeManager->getStore()->getWebsiteId()
102+
);
103+
}
71104
}

app/code/Magento/LoginAsCustomerFrontendUi/view/frontend/templates/html/notices.phtml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66

77
/**
88
* @var \Magento\Framework\View\Element\Template $block
99
* @var \Magento\Framework\Escaper $escaper
1010
*/
11-
$viewFileUrl = $block->getViewFileUrl('Magento_LoginAsCustomerFrontendUi::images/magento-icon.svg');
11+
if ($block->getConfig()->isB2bEnabled()) {
12+
$adobeFileUrl = $block->getViewFileUrl('Magento_LoginAsCustomerFrontendUi::images/adobe-icon.svg');
13+
} else {
14+
$adobeFileUrl = $block->getViewFileUrl('Magento_LoginAsCustomerFrontendUi::images/magento-icon.svg');
15+
}
1216
?>
1317
<?php if ($block->getConfig()->isEnabled()): ?>
1418
<div class="lac-notification-sticky"
@@ -17,7 +21,7 @@ $viewFileUrl = $block->getViewFileUrl('Magento_LoginAsCustomerFrontendUi::images
1721
<div class="lac-notification clearfix" data-bind="visible: isVisible" style="display: none">
1822
<div class="top-container">
1923
<div class="lac-notification-icon wrapper">
20-
<img class="logo-img" src="<?= $escaper->escapeUrl($viewFileUrl) ?>" alt="Magento" />
24+
<img class="logo-img" src="<?= $escaper->escapeUrl($adobeFileUrl) ?>" alt="Magento" />
2125
</div>
2226
<div class="lac-notification-text wrapper">
2327
<span data-bind="html: notificationText"></span>

app/code/Magento/LoginAsCustomerFrontendUi/view/frontend/web/css/source/_module.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2014 Adobe
3+
* All Rights Reserved.
44
*/
55

66
//
@@ -29,7 +29,7 @@
2929
margin: 10px 25px 10px 10px;
3030

3131
.logo-img {
32-
display: block
32+
display: block;
3333
}
3434
}
3535

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)