Skip to content

Commit 8f73566

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop latest changes
Accepted Community Pull Requests: - #25553: Fixed masonry grid rendering and styles (by @sivaschenko) - #25528: Relocate Watermark insert on image after resize. #25514 (by @Krielkip) - #25473: Fix loose switch comparison when adding links without content types (by @AydinHassan) - #25418: remove script tag (by @torhoehn) - #25354: Added backticks to table names in mysql schema reader. (by @vincenthornikx) Fixed GitHub Issues: - #23515: The display watermark size is incorrect compared to the original watermark images on list product,product page on magento2.3.2 (reported by @jordantran93) has been fixed in #25528 by @Krielkip in 2.3-develop branch Related commits: 1. 85415ef 2. 2263d2e - #25514: Image resizing and watermarking do no take into consideration the relative dimensions of the watermark and watermarked image. (reported by @janssentwh) has been fixed in #25528 by @Krielkip in 2.3-develop branch Related commits: 1. 85415ef 2. 2263d2e - #25050: Product AdditionalOptions "Read more" dots being escaped on invoice/shipment overview pages (reported by @itwebdev2) has been fixed in #25418 by @torhoehn in 2.3-develop branch Related commits: 1. e422942 2. 4b432f8 3. d4cae50 4. 6e36d5e
2 parents ac4af31 + 4d1e03f commit 8f73566

File tree

16 files changed

+225
-36
lines changed

16 files changed

+225
-36
lines changed

app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ private function getWatermark(string $type, int $scopeId = null): array
130130
);
131131

132132
if ($file) {
133-
$size = $this->scopeConfig->getValue(
134-
"design/watermark/{$type}_size",
135-
ScopeInterface::SCOPE_STORE,
136-
$scopeId
133+
$size = explode(
134+
'x',
135+
$this->scopeConfig->getValue(
136+
"design/watermark/{$type}_size",
137+
ScopeInterface::SCOPE_STORE
138+
)
137139
);
138140
$opacity = $this->scopeConfig->getValue(
139141
"design/watermark/{$type}_imageOpacity",
@@ -145,8 +147,8 @@ private function getWatermark(string $type, int $scopeId = null): array
145147
ScopeInterface::SCOPE_STORE,
146148
$scopeId
147149
);
148-
$width = !empty($size['width']) ? $size['width'] : null;
149-
$height = !empty($size['height']) ? $size['height'] : null;
150+
$width = !empty($size['0']) ? $size['0'] : null;
151+
$height = !empty($size['1']) ? $size['1'] : null;
150152

151153
return [
152154
'watermark_file' => $file,

app/code/Magento/MediaStorage/Service/ImageResize.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ private function resize(array $imageParams, string $originalImagePath, string $o
311311
]
312312
);
313313

314+
if ($imageParams['image_width'] !== null && $imageParams['image_height'] !== null) {
315+
$image->resize($imageParams['image_width'], $imageParams['image_height']);
316+
}
317+
314318
if (isset($imageParams['watermark_file'])) {
315319
if ($imageParams['watermark_height'] !== null) {
316320
$image->setWatermarkHeight($imageParams['watermark_height']);
@@ -331,9 +335,6 @@ private function resize(array $imageParams, string $originalImagePath, string $o
331335
$image->watermark($this->getWatermarkFilePath($imageParams['watermark_file']));
332336
}
333337

334-
if ($imageParams['image_width'] !== null && $imageParams['image_height'] !== null) {
335-
$image->resize($imageParams['image_width'], $imageParams['image_height']);
336-
}
337338
$image->save($imageAsset->getPath());
338339

339340
if ($this->fileStorageDatabase->checkDbUsage()) {

app/code/Magento/Sales/Block/Order/Item/Renderer/DefaultRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function getFormatedOptionValue($optionValue)
182182

183183
if ($this->string->strlen($optionValue) > 55) {
184184
$result['value'] = $result['value']
185-
. ' <a href="#" class="dots tooltip toggle" onclick="return false">...</a>';
185+
. ' ...';
186186
$optionValue = nl2br($optionValue);
187187
$result = array_merge($result, ['full_view' => $optionValue]);
188188
}

app/code/Magento/Sales/view/frontend/templates/order/creditmemo/items/renderer/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<?php if (!$block->getPrintStatus()) : ?>
1818
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
1919
<dd<?= (isset($_formatedOptionValue['full_view']) ? ' class="tooltip wrapper"' : '') ?>>
20-
<?= $block->escapeHtml($_formatedOptionValue['value']) ?>
20+
<?= $block->escapeHtml($_formatedOptionValue['value'], ['a', 'img']) ?>
2121
<?php if (isset($_formatedOptionValue['full_view'])) : ?>
2222
<div class="tooltip content">
2323
<dl class="item options">

app/code/Magento/Sales/view/frontend/templates/order/invoice/items/renderer/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<?php if (!$block->getPrintStatus()) : ?>
1818
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
1919
<dd<?= (isset($_formatedOptionValue['full_view']) ? ' class="tooltip wrapper"' : '') ?>>
20-
<?= $block->escapeHtml($_formatedOptionValue['value']) ?>
20+
<?= $block->escapeHtml($_formatedOptionValue['value'], ['a', 'img']) ?>
2121
<?php if (isset($_formatedOptionValue['full_view'])) : ?>
2222
<div class="tooltip content">
2323
<dl class="item options">

app/code/Magento/Sales/view/frontend/templates/order/items/renderer/default.phtml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ $_item = $block->getItem();
1616
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
1717
<?php if (!$block->getPrintStatus()) : ?>
1818
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
19-
<dd>
19+
<dd<?= (isset($_formatedOptionValue['full_view']) ? ' class="tooltip wrapper"' : '') ?>>
20+
<?= $block->escapeHtml($_formatedOptionValue['value'], ['a', 'img']) ?>
2021
<?php if (isset($_formatedOptionValue['full_view'])) : ?>
21-
<?= $block->escapeHtml($_formatedOptionValue['full_view'], ['a']) ?>
22-
<?php else : ?>
23-
<?=$block->escapeHtml($_formatedOptionValue['value'], ['a']) ?>
22+
<div class="tooltip content">
23+
<dl class="item options">
24+
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
25+
<dd><?= $block->escapeHtml($_formatedOptionValue['full_view']) ?></dd>
26+
</dl>
27+
</div>
2428
<?php endif; ?>
2529
</dd>
2630
<?php else : ?>
27-
<dd>
28-
<?= /* @noEscape */ nl2br($block->escapeHtml($_option['print_value'] ?? $_option['value'])) ?>
29-
</dd>
31+
<dd><?= $block->escapeHtml((isset($_option['print_value']) ? $_option['print_value'] : $_option['value'])) ?></dd>
3032
<?php endif; ?>
3133
<?php endforeach; ?>
3234
</dl>

app/code/Magento/Sales/view/frontend/templates/order/shipment/items/renderer/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<?php if (!$block->getPrintStatus()) : ?>
1717
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
1818
<dd<?= (isset($_formatedOptionValue['full_view']) ? ' class="tooltip wrapper"' : '') ?>>
19-
<?= $block->escapeHtml($_formatedOptionValue['value']) ?>
19+
<?= $block->escapeHtml($_formatedOptionValue['value'], ['a', 'img']) ?>
2020
<?php if (isset($_formatedOptionValue['full_view'])) : ?>
2121
<div class="tooltip content">
2222
<dl class="item options">

app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ define([
1010

1111
return Column.extend({
1212
defaults: {
13+
bodyTmpl: 'ui/grid/columns/image-preview',
1314
previewImageSelector: '[data-image-preview]',
1415
visibleRecord: null,
1516
height: 0,
1617
displayedRecord: {},
1718
lastOpenedImage: null,
19+
fields: {
20+
previewUrl: 'preview_url',
21+
title: 'title'
22+
},
1823
modules: {
1924
masonry: '${ $.parentName }',
2025
thumbnailComponent: '${ $.parentName }.thumbnail_url'
@@ -154,6 +159,26 @@ define([
154159
return this.visibleRecord() === record._rowIndex || false;
155160
},
156161

162+
/**
163+
* Returns preview image url for a given record.
164+
*
165+
* @param {Object} record
166+
* @return {String}
167+
*/
168+
getUrl: function (record) {
169+
return record[this.fields.previewUrl];
170+
},
171+
172+
/**
173+
* Returns image title for a given record.
174+
*
175+
* @param {Object} record
176+
* @return {String}
177+
*/
178+
getTitle: function (record) {
179+
return record[this.fields.title];
180+
},
181+
157182
/**
158183
* Get styles for preview
159184
*

app/code/Magento/Ui/view/base/web/js/grid/columns/image.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ define([
99

1010
return Column.extend({
1111
defaults: {
12+
bodyTmpl: 'ui/grid/columns/image',
1213
modules: {
1314
previewComponent: '${ $.parentName }.preview'
1415
},

app/code/Magento/Ui/view/base/web/js/grid/columns/overlay.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ define([
88
'use strict';
99

1010
return Column.extend({
11+
defaults: {
12+
bodyTmpl: 'ui/grid/columns/overlay'
13+
},
14+
1115
/**
1216
* If overlay should be visible
1317
*

app/code/Magento/Ui/view/base/web/js/grid/masonry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ define([
1313

1414
return Listing.extend({
1515
defaults: {
16-
template: 'Magento_Ui/grid/masonry',
16+
template: 'ui/grid/masonry',
1717
imports: {
1818
rows: '${ $.provider }:data.items',
1919
errorMessage: '${ $.provider }:data.errorMessage'

app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/_module.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
// */
55

66
@import 'module/_data-grid.less';
7+
@import 'module/_masonry-grid.less';
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// /**
2+
// * Copyright © Magento, Inc. All rights reserved.
3+
// * See COPYING.txt for license details.
4+
// */
5+
@admin__masonry_grid_image__space: 20px;
6+
@admin__masonry_grid_background_color: #fff;
7+
@admin__masonry_overlay_background_color: #507dc8;
8+
9+
& when (@media-common = true) {
10+
.masonry-image {
11+
&-grid {
12+
margin: @admin__masonry_grid_image__space/2 -(@admin__masonry_grid_image__space/2);
13+
overflow: hidden;
14+
position: relative;
15+
16+
.no-data-message-container,
17+
.error-message-container {
18+
font-size: @data-grid__no-records__font-size;
19+
padding: @data-grid__no-records__padding;
20+
text-align: center;
21+
}
22+
}
23+
24+
&-column {
25+
background-color: @admin__masonry_grid_background_color;
26+
float: left;
27+
margin: @admin__masonry_grid_image__space/2;
28+
overflow: hidden;
29+
30+
img {
31+
cursor: pointer;
32+
height: 100%;
33+
width: 100%;
34+
}
35+
}
36+
37+
&-overlay {
38+
background-color: @admin__masonry_overlay_background_color;
39+
color: @admin__masonry_grid_background_color;
40+
opacity: 1;
41+
padding: .5rem;
42+
position: absolute;
43+
text-align: center;
44+
width: 80px;
45+
z-index: 10;
46+
}
47+
48+
&-preview {
49+
background-color: @admin__masonry_grid_background_color;
50+
display: table;
51+
left: 0;
52+
position: absolute;
53+
right: 0;
54+
width: 100%;
55+
56+
.container {
57+
margin: auto;
58+
max-width: 880px;
59+
padding-top: 10px;
60+
61+
.action-buttons {
62+
text-align: right;
63+
64+
.action {
65+
&-close {
66+
padding: 30px;
67+
position: static;
68+
}
69+
70+
&-previous,
71+
&-next {
72+
background: transparent;
73+
border: none;
74+
margin: 0;
75+
white-space: nowrap;
76+
}
77+
78+
&-close,
79+
&-previous,
80+
&-next {
81+
font-size: 2rem;
82+
}
83+
}
84+
}
85+
86+
.preview-row-content {
87+
display: flex;
88+
89+
&:after {
90+
clear: both;
91+
content: '';
92+
display: table;
93+
}
94+
95+
img.preview {
96+
display: block;
97+
flex-basis: 300px;
98+
float: left;
99+
margin-bottom: 20px;
100+
max-height: 500px;
101+
max-width: 60%;
102+
width: auto;
103+
}
104+
}
105+
}
106+
}
107+
}
108+
}

lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function readIndexes($tableName, $resource)
126126
$indexes = [];
127127
$adapter = $this->resourceConnection->getConnection($resource);
128128
$condition = sprintf('`Non_unique` = 1');
129-
$sql = sprintf('SHOW INDEXES FROM %s WHERE %s', $tableName, $condition);
129+
$sql = sprintf('SHOW INDEXES FROM `%s` WHERE %s', $tableName, $condition);
130130
$stmt = $adapter->query($sql);
131131

132132
// Use FETCH_NUM so we are not dependent on the CASE attribute of the PDO connection
@@ -147,9 +147,10 @@ public function readIndexes($tableName, $resource)
147147
}
148148

149149
/**
150+
* Read references (foreign keys) from Magento tables.
151+
*
150152
* As MySQL has bug and do not show foreign keys during DESCRIBE and other directives required
151-
* to take it from SHOW CREATE TABLE ...
152-
* command
153+
* to take it from "SHOW CREATE TABLE ..." command.
153154
*
154155
* @inheritdoc
155156
*/
@@ -170,13 +171,14 @@ public function readReferences($tableName, $resource)
170171
public function getCreateTableSql($tableName, $resource)
171172
{
172173
$adapter = $this->resourceConnection->getConnection($resource);
173-
$sql = sprintf('SHOW CREATE TABLE %s', $tableName);
174+
$sql = sprintf('SHOW CREATE TABLE `%s`', $tableName);
174175
$stmt = $adapter->query($sql);
175176
return $stmt->fetch(\Zend_Db::FETCH_ASSOC);
176177
}
177178

178179
/**
179180
* Reading DB constraints.
181+
*
180182
* Primary and unique constraints are always non_unique=0.
181183
*
182184
* @inheritdoc
@@ -186,7 +188,7 @@ public function readConstraints($tableName, $resource)
186188
$constraints = [];
187189
$adapter = $this->resourceConnection->getConnection($resource);
188190
$condition = sprintf('`Non_unique` = 0');
189-
$sql = sprintf('SHOW INDEXES FROM %s WHERE %s', $tableName, $condition);
191+
$sql = sprintf('SHOW INDEXES FROM `%s` WHERE %s', $tableName, $condition);
190192
$stmt = $adapter->query($sql);
191193

192194
// Use FETCH_NUM so we are not dependent on the CASE attribute of the PDO connection

lib/internal/Magento/Framework/View/Page/Config/Renderer.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,18 @@ protected function getGroupAttributes($group)
349349
*/
350350
protected function addDefaultAttributes($contentType, $attributes)
351351
{
352-
switch ($contentType) {
353-
case 'js':
354-
$attributes = ' type="text/javascript" ' . $attributes;
355-
break;
352+
if ($contentType === 'js') {
353+
return ' type="text/javascript" ' . $attributes;
354+
}
356355

357-
case 'css':
358-
$attributes = ' rel="stylesheet" type="text/css" ' . ($attributes ?: ' media="all"');
359-
break;
356+
if ($contentType === 'css') {
357+
return ' rel="stylesheet" type="text/css" ' . ($attributes ?: ' media="all"');
358+
}
360359

361-
case $this->canTypeBeFont($contentType):
362-
$attributes = 'rel="preload" as="font" crossorigin="anonymous"';
363-
break;
360+
if ($this->canTypeBeFont($contentType)) {
361+
return 'rel="preload" as="font" crossorigin="anonymous"';
364362
}
363+
365364
return $attributes;
366365
}
367366

0 commit comments

Comments
 (0)