Skip to content

Commit b840466

Browse files
committed
Merge branch 'develop' of https://github.com/magento/magento2ce into MAGETWO-53583
2 parents e7b9f52 + fa0ed96 commit b840466

File tree

203 files changed

+2180
-782
lines changed

Some content is hidden

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

203 files changed

+2180
-782
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,7 @@ public function setBaseFile($file)
498498
$path = [
499499
$this->_catalogProductMediaConfig->getBaseMediaPath(),
500500
'cache',
501-
$this->_storeManager->getStore()->getId(),
502-
$path[] = $this->getDestinationSubdir(),
501+
$this->getDestinationSubdir(),
503502
];
504503
if (!empty($this->_width) || !empty($this->_height)) {
505504
$path[] = "{$this->_width}x{$this->_height}";

app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function testSetGetBaseFile()
180180
$this->image->setBaseFile('/somefile.png');
181181
$this->assertEquals('catalog/product/somefile.png', $this->image->getBaseFile());
182182
$this->assertEquals(
183-
'catalog/product/cache/1//beff4985b56e3afdbeabfc89641a4582/somefile.png',
183+
'catalog/product/cache//beff4985b56e3afdbeabfc89641a4582/somefile.png',
184184
$this->image->getNewFile()
185185
);
186186
}
@@ -302,7 +302,7 @@ public function testGetUrl()
302302
$this->testSetGetBaseFile();
303303
$url = $this->image->getUrl();
304304
$this->assertEquals(
305-
'http://magento.com/media/catalog/product/cache/1//beff4985b56e3afdbeabfc89641a4582/somefile.png',
305+
'http://magento.com/media/catalog/product/cache//beff4985b56e3afdbeabfc89641a4582/somefile.png',
306306
$url
307307
);
308308
}

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ImagesTest.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ protected function createModel()
2424

2525
public function testModifyData()
2626
{
27-
$this->assertSame($this->getSampleData(), $this->getModel()->modifyData($this->getSampleData()));
27+
$this->productMock->expects($this->once())->method('getId')->willReturn(2051);
28+
$actualResult = $this->getModel()->modifyData($this->getSampleData());
29+
$this->assertSame("", $actualResult[2051]['product']['media_gallery']['images'][0]['label']);
2830
}
2931

3032
public function testModifyMeta()
@@ -40,4 +42,24 @@ public function testModifyMeta()
4042

4143
$this->assertSame([], $this->getModel()->modifyMeta($meta));
4244
}
45+
46+
/**
47+
* {@inheritdoc}
48+
*/
49+
protected function getSampleData()
50+
{
51+
return [
52+
2051 => [
53+
'product' => [
54+
'media_gallery' => [
55+
'images' => [
56+
[
57+
'label' => null
58+
]
59+
]
60+
]
61+
]
62+
]
63+
];
64+
}
4365
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Images.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ public function modifyMeta(array $meta)
5151
*/
5252
public function modifyData(array $data)
5353
{
54+
/** @var \Magento\Catalog\Api\Data\ProductInterface $product */
55+
$product = $this->locator->getProduct();
56+
$modelId = $product->getId();
57+
if (
58+
isset($data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery'])
59+
&& !empty($data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery'])
60+
&& !empty($data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery']['images'])
61+
) {
62+
foreach ($data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery']['images'] as $index => $image) {
63+
if (!isset($image['label'])) {
64+
$data[$modelId][self::DATA_SOURCE_DEFAULT]['media_gallery']['images'][$index]['label'] = "";
65+
}
66+
}
67+
};
68+
5469
return $data;
5570
}
5671
}

app/code/Magento/CatalogInventory/Setup/UpgradeData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(
5454
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
5555
{
5656
$setup->startSetup();
57-
if (version_compare($context->getVersion(), '2.0.2') < 0) {
57+
if (version_compare($context->getVersion(), '2.2.0') < 0) {
5858
$this->upgradeCatalogInventoryStockItem($setup);
5959
}
6060
$setup->endSetup();

app/code/Magento/CatalogInventory/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_CatalogInventory" setup_version="2.0.2">
9+
<module name="Magento_CatalogInventory" setup_version="2.2.0">
1010
<sequence>
1111
<module name="Magento_Catalog"/>
1212
</sequence>

app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
$mode = 'grid';
1616

1717
$image = 'new_products_content_widget_grid';
18-
$title = $block->getTitle() ? __($block->getTitle()) : '';
1918
$items = $block->getProductCollection()->getItems();
2019

2120
$showWishlist = true;
@@ -25,9 +24,9 @@
2524
$description = false;
2625
?>
2726
<div class="block widget block-products-list <?php /* @noEscape */ echo $mode; ?>">
28-
<?php if ($title): ?>
27+
<?php if ($block->getTitle()): ?>
2928
<div class="block-title">
30-
<strong><?php echo $block->escapeHtml($title); ?></strong>
29+
<strong><?php echo $block->escapeHtml(__($block->getTitle())); ?></strong>
3130
</div>
3231
<?php endif ?>
3332
<div class="block-content">
@@ -64,27 +63,23 @@
6463
<div class="actions-primary">
6564
<?php if ($_item->isSaleable()): ?>
6665
<?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?>
67-
<button class="action tocart primary"
68-
data-mage-init='{"redirectUrl":{"url":"<?php echo $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}'
69-
type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
70-
<span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
66+
<button class="action tocart primary" data-mage-init='{"redirectUrl":{"url":"<?php echo $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?php echo $block->escapeHtmlAttr(__('Add to Cart')) ?>">
67+
<span><?php echo $block->escapeHtml(__('Add to Cart')) ?></span>
7168
</button>
7269
<?php else: ?>
7370
<?php
7471
$postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper');
7572
$postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()])
7673
?>
77-
<button class="action tocart primary"
78-
data-post='<?php /* @noEscape */ echo $postData; ?>'
79-
type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
80-
<span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
74+
<button class="action tocart primary" data-post='<?php /* @noEscape */ echo $postData; ?>' type="button" title="<?php echo $block->escapeHtmlAttr(__('Add to Cart')) ?>">
75+
<span><?php echo $block->escapeHtml(__('Add to Cart')) ?></span>
8176
</button>
8277
<?php endif; ?>
8378
<?php else: ?>
8479
<?php if ($_item->getIsSalable()): ?>
85-
<div class="stock available"><span><?php /* @escapeNotVerified */ echo __('In stock') ?></span></div>
80+
<div class="stock available"><span><?php echo $block->escapeHtml(__('In stock')) ?></span></div>
8681
<?php else: ?>
87-
<div class="stock unavailable"><span><?php /* @escapeNotVerified */ echo __('Out of stock') ?></span></div>
82+
<div class="stock unavailable"><span><?php echo $block->escapeHtml(__('Out of stock')) ?></span></div>
8883
<?php endif; ?>
8984
<?php endif; ?>
9085
</div>
@@ -93,18 +88,14 @@
9388
<div class="actions-secondary" data-role="add-to-links">
9489
<?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?>
9590
<a href="#"
96-
data-post='<?php /* @noEscape */ echo $block->getAddToWishlistParams($_item); ?>'
97-
class="action towishlist" data-action="add-to-wishlist"
98-
title="<?php /* @escapeNotVerified */ echo __('Add to Wish List') ?>">
99-
<span><?php /* @escapeNotVerified */ echo __('Add to Wish List') ?></span>
91+
data-post='<?php /* @noEscape */ echo $block->getAddToWishlistParams($_item); ?>' class="action towishlist" data-action="add-to-wishlist" title="<?php echo $block->escapeHtmlAttr(__('Add to Wish List')) ?>">
92+
<span><?php echo $block->escapeHtml(__('Add to Wish List')) ?></span>
10093
</a>
10194
<?php endif; ?>
10295
<?php if ($block->getAddToCompareUrl() && $showCompare): ?>
10396
<?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?>
104-
<a href="#" class="action tocompare"
105-
data-post='<?php /* @noEscape */ echo $compareHelper->getPostDataParams($_item);?>'
106-
title="<?php /* @escapeNotVerified */ echo __('Add to Compare') ?>">
107-
<span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span>
97+
<a href="#" class="action tocompare" data-post='<?php /* @noEscape */ echo $compareHelper->getPostDataParams($_item);?>' title="<?php echo $block->escapeHtmlAttr(__('Add to Compare')) ?>">
98+
<span><?php echo $block->escapeHtml(__('Add to Compare')) ?></span>
10899
</a>
109100
<?php endif; ?>
110101
</div>

app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ $_height = $block->getImagesHeight();
2121
<?php endif; ?>
2222
</p>
2323
<?php if ($block->getFileWidth($file)): ?>
24-
<small><?php echo $block->escapeHtml($block->getFileWidth($file)) ?>x<?php echo $block->escapeHtml($block->getFileHeight($file)) ?> <?php /* @escapeNotVerified */ echo __('px.') ?></small><br/>
24+
<small><?php echo $block->escapeHtml($block->getFileWidth($file)) ?>x<?php echo $block->escapeHtml($block->getFileHeight($file)) ?> <?php echo $block->escapeHtml(__('px.')) ?></small><br/>
2525
<?php endif; ?>
2626
<small><?php echo $block->escapeHtml($block->getFileShortName($file)); ?></small>
2727
</div>
2828
<?php endforeach; ?>
2929
<?php else: ?>
30-
<div class="empty"><?php /* @escapeNotVerified */ echo __('No files found') ?></div>
30+
<div class="empty"><?php echo $block->escapeHtml(__('No files found')) ?></div>
3131
<?php endif; ?>

app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<div id="<?php echo $block->getHtmlId() ?>" class="uploader">
1313
<span class="fileinput-button form-buttons">
14-
<span><?php /* @escapeNotVerified */ echo __('Browse Files...') ?></span>
14+
<span><?php echo $block->escapeHtml(__('Browse Files...')) ?></span>
1515
<input class="fileupload" type="file" name="<?php echo $block->escapeHtmlAttr($block->getConfig()->getFileField()) ?>" data-url="<?php echo $block->escapeUrl($block->getConfig()->getUrl()) ?>" multiple>
1616
</span>
1717
<div class="clear"></div>

app/code/Magento/Cms/view/adminhtml/templates/browser/tree.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<div class="tree-panel" >
1212
<div class="categories-side-col">
1313
<div class="tree-actions">
14-
<a onclick="jQuery('[data-role=tree]').jstree('close_all');"><?php /* @escapeNotVerified */ echo __('Collapse All'); ?></a>
14+
<a onclick="jQuery('[data-role=tree]').jstree('close_all');"><?php echo $block->escapeHtml(__('Collapse All')) ?></a>
1515
<span class="separator">|</span>
16-
<a onclick="jQuery('[data-role=tree]').jstree('open_all');"><?php /* @escapeNotVerified */ echo __('Expand All'); ?></a>
16+
<a onclick="jQuery('[data-role=tree]').jstree('open_all');"><?php echo $block->escapeHtml(__('Expand All')) ?></a>
1717
</div>
1818
</div>
1919
<div data-role="tree" data-mage-init='<?php echo $block->escapeHtml($this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getTreeWidgetOptions())); ?>'>

0 commit comments

Comments
 (0)