Skip to content

Commit e0f40b8

Browse files
committed
MC-23383: Introduce image lazy loading mechanism
- Fix static fails;
1 parent e042fca commit e0f40b8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
/** @var $block \Magento\Catalog\Block\Product\Image */
99
/** @var $escaper \Magento\Framework\Escaper */
1010
$borders = (bool)$block->getVar('product_image_white_borders', 'Magento_Catalog');
11-
$enableLazyLoadingWithoutBorders = (bool)$block->getVar('enable_lazy_loading_for_images_without_borders', 'Magento_Catalog');
11+
$enableLazyLoadingWithoutBorders = (bool)$block->getVar(
12+
'enable_lazy_loading_for_images_without_borders',
13+
'Magento_Catalog'
14+
);
1215
?>
1316

1417
<span class="product-image-container"
@@ -21,11 +24,12 @@ $enableLazyLoadingWithoutBorders = (bool)$block->getVar('enable_lazy_loading_for
2124
<?php endforeach; ?>
2225
src="<?= $escaper->escapeUrl($block->getImageUrl()) ?>"
2326
loading="lazy"
24-
<!-- Enable lazy loading for images with borders and if variable enable_lazy_loading_for_images_without_borders in view.xml is enabled -->
25-
<?php if ($borders || $enableLazyLoadingWithoutBorders) :?>
27+
<!-- Enable lazy loading for images with borders and if variable
28+
enable_lazy_loading_for_images_without_borders in view.xml is enabled -->
29+
<?php if ($borders || $enableLazyLoadingWithoutBorders) : ?>
2630
width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
2731
height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
28-
<?php else :?>
32+
<?php else : ?>
2933
max-width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>"
3034
max-height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>"
3135
<?php endif; ?>

0 commit comments

Comments
 (0)