Skip to content

Commit e13e60e

Browse files
committed
Merge branch '2.4-develop' of github.com:magento/magento2ce into MC-33884
2 parents fce0c05 + db5bc62 commit e13e60e

File tree

103 files changed

+1176
-574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1176
-574
lines changed

app/code/Magento/Catalog/etc/view.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
99
<vars module="Magento_Catalog">
1010
<var name="product_image_white_borders">1</var>
11+
<!-- Variable to enable lazy loading for catalog product images without borders.
12+
If you enable this setting your small size images without borders may be stretched in template.
13+
So be sure you have correct image sizes. -->
14+
<var name="enable_lazy_loading_for_images_without_borders">0</var>
1115
</vars>
1216
</view>

app/code/Magento/Catalog/view/frontend/templates/product/image.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/** @var $block \Magento\Catalog\Block\Product\Image */
99
/** @var $escaper \Magento\Framework\Escaper */
1010
?>
11-
11+
<!--deprecated template as image_with_borders is a primary one-->
1212
<img class="photo image <?= $escaper->escapeHtmlAttr($block->getClass()) ?>"
1313
<?php foreach ($block->getCustomAttributes() as $name => $value): ?>
1414
<?= $escaper->escapeHtmlAttr($name) ?>="<?= $escaper->escapeHtmlAttr($value) ?>"

app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
<?php
88
/** @var $block \Magento\Catalog\Block\Product\Image */
99
/** @var $escaper \Magento\Framework\Escaper */
10+
/**
11+
* Enable lazy loading for images with borders and if variable enable_lazy_loading_for_images_without_borders
12+
* is enabled in view.xml. Otherwise small size images without borders may be distorted. So max-width is used for them
13+
* to prevent stretching and lazy loading does not work.
14+
*/
15+
$borders = (bool)$block->getVar('product_image_white_borders', 'Magento_Catalog');
16+
$enableLazyLoadingWithoutBorders = (bool)$block->getVar(
17+
'enable_lazy_loading_for_images_without_borders',
18+
'Magento_Catalog'
19+
);
1020
?>
1121

1222
<span class="product-image-container"
@@ -19,7 +29,12 @@
1929
<?php endforeach; ?>
2030
src="<?= $escaper->escapeUrl($block->getImageUrl()) ?>"
2131
loading="lazy"
22-
width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
23-
height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
32+
<?php if ($borders || $enableLazyLoadingWithoutBorders): ?>
33+
width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
34+
height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
35+
<?php else: ?>
36+
max-width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
37+
max-height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
38+
<?php endif; ?>
2439
alt="<?= $escaper->escapeHtmlAttr($block->getLabel()) ?>"/></span>
2540
</span>

app/code/Magento/Customer/view/frontend/layout/customer_account_index.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
</action>
1515
</referenceBlock>
1616
<referenceContainer name="content">
17-
<block class="Magento\Customer\Block\Account\Dashboard\Info" name="customer_account_dashboard_info" as="info" template="Magento_Customer::account/dashboard/info.phtml" cacheable="false"/>
17+
<block class="Magento\Customer\Block\Account\Dashboard\Info" name="customer_account_dashboard_info" as="info" template="Magento_Customer::account/dashboard/info.phtml" cacheable="false">
18+
<container name="customer.account.dashboard.info.blocks" as="additional_blocks"/>
19+
</block>
1820
<block class="Magento\Customer\Block\Account\Dashboard\Address" name="customer_account_dashboard_address" as="address" template="Magento_Customer::account/dashboard/address.phtml" cacheable="false"/>
1921
</referenceContainer>
2022
</body>

app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,26 @@
2929
</a>
3030
</div>
3131
</div>
32-
<?php if ($block->isNewsletterEnabled()) : ?>
32+
<?php if ($block->isNewsletterEnabled()): ?>
3333
<div class="box box-newsletter">
3434
<strong class="box-title">
3535
<span><?= $block->escapeHtml(__('Newsletters')) ?></span>
3636
</strong>
3737
<div class="box-content">
3838
<p>
39-
<?php if ($block->getIsSubscribed()) : ?>
39+
<?php if ($block->getIsSubscribed()): ?>
4040
<?= $block->escapeHtml(__('You are subscribed to "General Subscription".')) ?>
41-
<?php else : ?>
41+
<?php else: ?>
4242
<?= $block->escapeHtml(__('You aren\'t subscribed to our newsletter.')) ?>
4343
<?php endif; ?>
4444
</p>
4545
</div>
4646
<div class="box-actions">
47-
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('newsletter/manage')) ?>"><span><?= $block->escapeHtml(__('Edit')) ?></span></a>
47+
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('newsletter/manage')) ?>">
48+
<span><?= $block->escapeHtml(__('Edit')) ?></span></a>
4849
</div>
4950
</div>
5051
<?php endif; ?>
52+
<?= $block->getChildHtml('additional_blocks'); ?>
5153
</div>
5254
</div>

app/code/Magento/LoginAsCustomer/Model/AuthenticateCustomer.php renamed to app/code/Magento/LoginAsCustomer/Model/AuthenticateCustomerBySecret.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,45 @@
99

1010
use Magento\Customer\Model\Session;
1111
use Magento\Framework\Exception\LocalizedException;
12-
use Magento\LoginAsCustomerApi\Api\AuthenticateCustomerInterface;
13-
use Magento\LoginAsCustomerApi\Api\Data\AuthenticationDataInterface;
12+
use Magento\LoginAsCustomerApi\Api\AuthenticateCustomerBySecretInterface;
13+
use Magento\LoginAsCustomerApi\Api\GetAuthenticationDataBySecretInterface;
1414

1515
/**
1616
* @inheritdoc
1717
*
1818
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1919
*/
20-
class AuthenticateCustomer implements AuthenticateCustomerInterface
20+
class AuthenticateCustomerBySecret implements AuthenticateCustomerBySecretInterface
2121
{
22+
/**
23+
* @var GetAuthenticationDataBySecretInterface
24+
*/
25+
private $getAuthenticationDataBySecret;
26+
2227
/**
2328
* @var Session
2429
*/
2530
private $customerSession;
2631

2732
/**
33+
* @param GetAuthenticationDataBySecretInterface $getAuthenticationDataBySecret
2834
* @param Session $customerSession
2935
*/
3036
public function __construct(
37+
GetAuthenticationDataBySecretInterface $getAuthenticationDataBySecret,
3138
Session $customerSession
3239
) {
40+
$this->getAuthenticationDataBySecret = $getAuthenticationDataBySecret;
3341
$this->customerSession = $customerSession;
3442
}
3543

3644
/**
3745
* @inheritdoc
3846
*/
39-
public function execute(AuthenticationDataInterface $authenticationData): void
47+
public function execute(string $secret): void
4048
{
49+
$authenticationData = $this->getAuthenticationDataBySecret->execute($secret);
50+
4151
if ($this->customerSession->getId()) {
4252
$this->customerSession->logout();
4353
}

app/code/Magento/LoginAsCustomer/Model/ResourceModel/DeleteExpiredAuthenticationData.php renamed to app/code/Magento/LoginAsCustomer/Model/ResourceModel/DeleteAuthenticationDataForUser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
use Magento\Framework\App\ResourceConnection;
1111
use Magento\Framework\Stdlib\DateTime\DateTime;
1212
use Magento\LoginAsCustomerApi\Api\ConfigInterface;
13-
use Magento\LoginAsCustomerApi\Api\DeleteExpiredAuthenticationDataInterface;
13+
use Magento\LoginAsCustomerApi\Api\DeleteAuthenticationDataForUserInterface;
1414

1515
/**
1616
* @inheritdoc
1717
*/
18-
class DeleteExpiredAuthenticationData implements DeleteExpiredAuthenticationDataInterface
18+
class DeleteAuthenticationDataForUser implements DeleteAuthenticationDataForUserInterface
1919
{
2020
/**
2121
* @var ResourceConnection

app/code/Magento/LoginAsCustomer/Model/ResourceModel/GetAuthenticationDataBySecret.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(
6161
/**
6262
* @inheritdoc
6363
*/
64-
public function execute(string $secretKey): AuthenticationDataInterface
64+
public function execute(string $secret): AuthenticationDataInterface
6565
{
6666
$connection = $this->resourceConnection->getConnection();
6767
$tableName = $this->resourceConnection->getTableName('login_as_customer');
@@ -73,7 +73,7 @@ public function execute(string $secretKey): AuthenticationDataInterface
7373

7474
$select = $connection->select()
7575
->from(['main_table' => $tableName])
76-
->where('main_table.secret = ?', $secretKey)
76+
->where('main_table.secret = ?', $secret)
7777
->where('main_table.created_at > ?', $timePoint);
7878

7979
$data = $connection->fetchRow($select);

app/code/Magento/LoginAsCustomerUi/Plugin/AdminLogoutPlugin.php renamed to app/code/Magento/LoginAsCustomer/Plugin/AdminLogoutPlugin.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\LoginAsCustomerUi\Plugin;
8+
namespace Magento\LoginAsCustomer\Plugin;
99

1010
use Magento\Backend\Model\Auth;
1111
use Magento\LoginAsCustomerApi\Api\ConfigInterface;
12-
use Magento\LoginAsCustomerApi\Api\DeleteExpiredAuthenticationDataInterface;
12+
use Magento\LoginAsCustomerApi\Api\DeleteAuthenticationDataForUserInterface;
1313

1414
/**
1515
* Delete all Login as Customer sessions for logging out admin.
@@ -22,20 +22,20 @@ class AdminLogoutPlugin
2222
private $config;
2323

2424
/**
25-
* @var DeleteExpiredAuthenticationDataInterface
25+
* @var DeleteAuthenticationDataForUserInterface
2626
*/
27-
private $deleteExpiredAuthenticationData;
27+
private $deleteAuthenticationDataForUser;
2828

2929
/**
3030
* @param ConfigInterface $config
31-
* @param DeleteExpiredAuthenticationDataInterface $deleteExpiredAuthenticationData
31+
* @param DeleteAuthenticationDataForUserInterface $deleteAuthenticationDataForUser
3232
*/
3333
public function __construct(
3434
ConfigInterface $config,
35-
DeleteExpiredAuthenticationDataInterface $deleteExpiredAuthenticationData
35+
DeleteAuthenticationDataForUserInterface $deleteAuthenticationDataForUser
3636
) {
3737
$this->config = $config;
38-
$this->deleteExpiredAuthenticationData = $deleteExpiredAuthenticationData;
38+
$this->deleteAuthenticationDataForUser = $deleteAuthenticationDataForUser;
3939
}
4040

4141
/**
@@ -47,7 +47,7 @@ public function beforeLogout(Auth $subject): void
4747
{
4848
if ($this->config->isEnabled()) {
4949
$userId = (int)$subject->getUser()->getId();
50-
$this->deleteExpiredAuthenticationData->execute($userId);
50+
$this->deleteAuthenticationDataForUser->execute($userId);
5151
}
5252
}
5353
}

app/code/Magento/LoginAsCustomer/composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"magento/module-customer": "*",
88
"magento/module-login-as-customer-api": "*"
99
},
10+
"suggest": {
11+
"magento/module-backend": "*"
12+
},
1013
"type": "magento2-module",
1114
"license": [
1215
"OSL-3.0",

0 commit comments

Comments
 (0)