Skip to content

Commit 3aa4a2f

Browse files
author
Igor Miniailo
committed
Merge branch 'PR4' into product-video-PR4
2 parents d4d2ab6 + c4d4643 commit 3aa4a2f

File tree

14 files changed

+701
-651
lines changed

14 files changed

+701
-651
lines changed

app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js

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

3939
var findElement = function (data) {
4040
return $container.find('.image:not(.image-placeholder)').filter(function () {
41-
if(!$(this).data('image')) {
41+
if (!$(this).data('image')) {
4242
return false;
4343
}
4444
return $(this).data('image').file === data.file;

app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js

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

2121
var params = {};
2222
var fields = $('category_edit_form').getElementsBySelector('input', 'select');
23-
for(var i=0;i<fields.length;i++){
23+
for (var i=0; i<fields.length; i++) {
2424
if (!fields[i].name) {
2525
continue;
2626
}

app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,9 @@ define([
703703
mageData.scripts.map(function(script) {
704704
return eval(script);
705705
});
706-
} catch (e) {}
706+
} catch (e) {
707+
708+
}
707709
this.restorePhase = false;
708710
}
709711
break;

app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ define([
301301
* @private
302302
*/
303303
_onOpenDialog: function(e, imageData) {
304-
if(imageData.media_type && imageData.media_type != 'image') {
304+
if (imageData.media_type && imageData.media_type != 'image') {
305305
return;
306306
}
307307
this._showDialog(imageData);
@@ -315,7 +315,7 @@ define([
315315
_showDialog: function (imageData) {
316316
var $imageContainer = this.findElement(imageData);
317317
var dialogElement = $imageContainer.data('dialog');
318-
if(!this.dialogTmpl) {
318+
if (!this.dialogTmpl) {
319319
alert('System problem!');
320320
return;
321321
}

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

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

4747
submitForm: function(form) {
4848
var self = this;
49-
if (form.has('input[type="file"]').length && form.find('input[type="file"]').val() !== '') {
49+
if (form.has('input[type="file"]').length && form.find('input[type="file"]').val() !== '') {
5050
self.element.off('submit');
5151
form.submit();
5252
} else {

app/code/Magento/ProductVideo/Block/Adminhtml/Product/Edit/NewVideo.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class NewVideo extends \Magento\Backend\Block\Widget\Form\Generic
2525
/**
2626
* @var \Magento\Framework\UrlInterface
2727
*/
28-
protected $_urlBuilder;
28+
protected $urlBuilder;
2929

3030
/**
3131
* @var \Magento\Framework\Json\EncoderInterface
@@ -34,25 +34,23 @@ class NewVideo extends \Magento\Backend\Block\Widget\Form\Generic
3434

3535
/**
3636
* @param \Magento\Backend\Block\Template\Context $context
37-
* @param \Magento\ProductVideo\Helper\Media $mediaHelper
38-
* @param \Magento\Framework\UrlInterface $urlBuilder
39-
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
4037
* @param \Magento\Framework\Registry $registry
4138
* @param \Magento\Framework\Data\FormFactory $formFactory
39+
* @param \Magento\ProductVideo\Helper\Media $mediaHelper
40+
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
4241
* @param array $data
4342
*/
4443
public function __construct(
4544
\Magento\Backend\Block\Template\Context $context,
46-
\Magento\ProductVideo\Helper\Media $mediaHelper,
47-
\Magento\Framework\UrlInterface $urlBuilder,
48-
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
4945
\Magento\Framework\Registry $registry,
5046
\Magento\Framework\Data\FormFactory $formFactory,
47+
\Magento\ProductVideo\Helper\Media $mediaHelper,
48+
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
5149
array $data = []
5250
) {
5351
parent::__construct($context, $registry, $formFactory, $data);
5452
$this->mediaHelper = $mediaHelper;
55-
$this->_urlBuilder = $urlBuilder;
53+
$this->urlBuilder = $context->getUrlBuilder();
5654
$this->jsonEncoder = $jsonEncoder;
5755
$this->setUseContainer(true);
5856
}
@@ -271,11 +269,10 @@ protected function addMediaRoleAttributes(Fieldset $fieldset)
271269
protected function getNoteVideoUrl()
272270
{
273271
$result = __('YouTube and Vimeo supported.');
274-
if (is_null($this->mediaHelper->getYouTubeApiKey())) {
272+
if ($this->mediaHelper->getYouTubeApiKey() === null) {
275273
$result = __(
276-
'Vimeo supported.<br>'
277-
. 'To add YouTube video, please <a href="%1">enter YouTube API Key</a> first.'
278-
,
274+
'Vimeo supported.<br />'
275+
. 'To add YouTube video, please <a href="%1">enter YouTube API Key</a> first.',
279276
$this->getConfigApiKeyUrl()
280277
);
281278
}
@@ -289,7 +286,7 @@ protected function getNoteVideoUrl()
289286
*/
290287
protected function getConfigApiKeyUrl()
291288
{
292-
return $this->_urlBuilder->getUrl(
289+
return $this->urlBuilder->getUrl(
293290
'adminhtml/system_config/edit',
294291
[
295292
'section' => 'catalog',

app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,18 @@ protected function localFileName($fileName)
124124
/**
125125
* @param string $fileUrl
126126
* @param string $localFilePath
127-
* @return bool|void
127+
* @return void
128+
* @throws \Magento\Framework\Exception\LocalizedException
128129
*/
129130
protected function retrieveRemoteImage($fileUrl, $localFilePath)
130131
{
131132
$this->curl->setConfig(['header' => false]);
132133
$this->curl->write('GET', $fileUrl);
133134
$image = $this->curl->read();
134135
if (empty($image)) {
135-
throw new \InvalidArgumentException(__('Couldn\'t retrive a remote preview image file. Service is inaccessible.'));
136+
throw new \Magento\Framework\Exception\LocalizedException(
137+
__('Could not get video information. Please check your connection and try again.')
138+
);
136139
}
137140
$this->fileUtility->saveFile($localFilePath, $image);
138141
}

app/code/Magento/ProductVideo/Model/Plugin/ExternalVideoEntryProcessor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class ExternalVideoEntryProcessor
4848

4949
/**
5050
* @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Media $resourceEntryMediaGallery
51+
* @param \Magento\ProductVideo\Model\ResourceModel\Video $videoResourceModel
5152
*/
5253
public function __construct(
5354
\Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Media $resourceEntryMediaGallery,

app/code/Magento/ProductVideo/Model/Plugin/ExternalVideoResourceBackend.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace Magento\ProductVideo\Model\Plugin;
88

99
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Media;
10-
use Magento\ProductVideo\Setup\InstallSchema;
1110

1211
/**
1312
* Attribute Media Resource decorator
@@ -37,7 +36,7 @@ public function __construct(\Magento\ProductVideo\Model\ResourceModel\Video $vid
3736
public function afterDuplicate(Media $originalResourceModel, array $valueIdMap)
3837
{
3938
$mediaGalleryEntitiesData = $this->videoResourceModel->loadByIds(array_keys($valueIdMap));
40-
foreach($mediaGalleryEntitiesData as $row) {
39+
foreach ($mediaGalleryEntitiesData as $row) {
4140
$row['value_id'] = $valueIdMap[$row['value_id']];
4241
$this->videoResourceModel->insertOnDuplicate($row);
4342
}

0 commit comments

Comments
 (0)