Skip to content

Commit 92e01d0

Browse files
del77428lucafuser
authored andcommitted
Added changes for b2b and ce separate logos AC-13628
1 parent 0169cc5 commit 92e01d0

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
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');
12-
$adobeFileUrl = $block->getViewFileUrl('Magento_LoginAsCustomerFrontendUi::images/adobe-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+
}
1316
?>
1417
<?php if ($block->getConfig()->isEnabled()): ?>
1518
<div class="lac-notification-sticky"

0 commit comments

Comments
 (0)