Skip to content

Commit 8ca180f

Browse files
author
Ievgen Sentiabov
committed
Merge branch 'develop' of github.corp.ebay.com:magento2/magento2ce into MAGETWO-43348
2 parents 2a178f9 + d2dc4bb commit 8ca180f

File tree

99 files changed

+5871
-1221
lines changed

Some content is hidden

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

99 files changed

+5871
-1221
lines changed

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ public function getHintHtml()
548548
$html = '';
549549
$url = $this->getHintUrl();
550550
if ($url) {
551-
$html = '<div class="tooltip">' . '<span class="help"><a' . ' href="' . $this->escapeUrl(
551+
$html = '<div class="admin__field-tooltip tooltip">' . '<a' . ' href="' . $this->escapeUrl(
552552
$url
553553
) . '"' . ' onclick="this.target=\'_blank\'"' . ' title="' . __(
554554
'What is this?'
555-
) . '"' . ' class="link-store-scope"><span>' . __(
555+
) . '"' . ' class="admin__field-tooltip-action action-help"><span>' . __(
556556
'What is this?'
557557
) . '</span></a></span>' . ' </div>';
558558
}

app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
<?php endif; ?>
1414

1515
<?php if (!$_element->getNoContainer()): ?>
16-
<fieldset class="fieldset <?php /* @escapeNotVerified */ echo $_element->getClass() ?>" id="<?php echo $_element->getHtmlId() ?>">
16+
<fieldset class="admin__fieldset fieldset <?php /* @escapeNotVerified */ echo $_element->getClass() ?>" id="<?php echo $_element->getHtmlId() ?>">
1717
<?php endif; ?>
1818

1919
<?php if ($_element->getLegend()): ?>
20-
<legend class="legend">
20+
<legend class="admin__legend legend">
2121
<span><?php /* @escapeNotVerified */ echo $_element->getLegend() ?></span>
22-
</legend>
22+
</legend><br/>
2323
<?php /* @escapeNotVerified */ echo $_element->getHeaderBar() ?>
2424
<?php endif; ?>
2525
<?php echo $block->getHintHtml() ?>

app/code/Magento/Backend/view/adminhtml/templates/store/switcher/form/renderer/fieldset/element.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ $note = $element->getNote() ? '<div class="note">' . $element->getNote() . '</di
1414
$elementBeforeLabel = $element->getExtType() == 'checkbox' || $element->getExtType() == 'radio';
1515
$addOn = $element->getBeforeElementHtml() || $element->getAfterElementHtml();
1616
$fieldId = ($element->getHtmlContainerId()) ? ' id="' . $element->getHtmlContainerId() . '"' : '';
17-
$fieldClass = "field field-{$element->getId()} {$element->getCssClass()}";
17+
$fieldClass = "admin__field field field-{$element->getId()} {$element->getCssClass()}";
1818
$fieldClass .= ($elementBeforeLabel) ? ' choice' : '';
1919
$fieldClass .= ($addOn) ? ' with-addon' : '';
20-
$fieldClass .= ($element->getRequired()) ? ' required' : '';
20+
$fieldClass .= ($element->getRequired()) ? ' _required' : '';
2121
$fieldClass .= ($note) ? ' with-note' : '';
2222

2323
$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
@@ -35,16 +35,16 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
3535
<?php /* @escapeNotVerified */ echo $note ?>
3636
<?php else: ?>
3737
<?php echo $element->getLabelHtml() ?>
38-
<div class="control">
38+
<div class="admin__field-control control">
3939
<?php /* @escapeNotVerified */ echo($addOn) ? '<div class="addon">' . $element->getElementHtml() . '</div>' : $element->getElementHtml(); ?>
40+
<?php echo $block->getHintHtml() ?>
4041
<?php /* @escapeNotVerified */ echo $note ?>
4142
</div>
4243
<?php endif; ?>
4344
<?php if ($element->getScopeLabel()): ?>
4445
<div class="field-service" value-scope="<?php /* @escapeNotVerified */ echo $element->getScopeLabel()?>">
4546
</div>
4647
<?php endif;?>
47-
<?php echo $block->getHintHtml() ?>
4848
</div>
4949
<?php endif; ?>
5050
<?php endif; ?>

app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ if ($isField) {
5757
<?php if (!$element->getNoContainer()): ?>
5858
<fieldset class="<?php /* @escapeNotVerified */ echo $cssClass ?>" id="<?php /* @escapeNotVerified */ echo $id ?>">
5959
<?php if ($element->getLegend() && !$isWrapped): ?>
60-
<legend class="<?php /* @escapeNotVerified */ echo $isField ? 'label' : 'legend'?>">
60+
<legend class="<?php /* @escapeNotVerified */ echo $isField ? 'label admin__field-label' : 'admin__legend legend'?>">
6161
<span><?php /* @escapeNotVerified */ echo $element->getLegend() ?></span>
6262
</legend><br />
6363
<?php endif; ?>

app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryInterface.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface ProductAttributeMediaGalleryEntryInterface extends ExtensibleDataInter
1919
const POSITION = 'position';
2020
const DISABLED = 'disabled';
2121
const TYPES = 'types';
22+
const MEDIA_TYPE = 'media_type';
2223
const FILE = 'file';
2324
const CONTENT = 'content';
2425

@@ -37,6 +38,21 @@ public function getId();
3738
*/
3839
public function setId($id);
3940

41+
/**
42+
* Get media type
43+
*
44+
* @return string
45+
*/
46+
public function getMediaType();
47+
48+
/**
49+
* Set media type
50+
*
51+
* @param string $mediaType
52+
* @return $this
53+
*/
54+
public function setMediaType($mediaType);
55+
4056
/**
4157
* Retrieve gallery entry alternative text
4258
*

app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ public function remove($sku, $entryId);
6262
* Return information about gallery entry
6363
*
6464
* @param string $sku
65-
* @param int $imageId
65+
* @param int $entryId
6666
* @throws \Magento\Framework\Exception\NoSuchEntityException
6767
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface
6868
*/
69-
public function get($sku, $imageId);
69+
public function get($sku, $entryId);
7070

7171
/**
7272
* Retrieve the list of gallery entries associated with given product

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php

Lines changed: 69 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,42 @@
1111
*/
1212
namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form;
1313

14+
/**
15+
* Class BaseImage
16+
*/
1417
class BaseImage extends \Magento\Framework\Data\Form\Element\AbstractElement
1518
{
19+
/**
20+
* Element output template
21+
*/
22+
const ELEMENT_OUTPUT_TEMPLATE = 'Magento_Catalog::product/edit/base_image.phtml';
23+
1624
/**
1725
* Model Url instance
1826
*
1927
* @var \Magento\Backend\Model\UrlInterface
2028
*/
21-
protected $_url;
29+
protected $url;
2230

2331
/**
2432
* @var \Magento\Catalog\Helper\Data
2533
*/
26-
protected $_catalogHelperData;
34+
protected $catalogHelperData;
2735

2836
/**
2937
* @var \Magento\Framework\File\Size
3038
*/
31-
protected $_fileConfig;
39+
protected $fileConfig;
3240

3341
/**
3442
* @var \Magento\Framework\View\Asset\Repository
3543
*/
36-
protected $_assetRepo;
44+
protected $assetRepo;
45+
46+
/**
47+
* @var \Magento\Framework\View\LayoutInterface
48+
*/
49+
protected $layout;
3750

3851
/**
3952
* @param \Magento\Framework\Data\Form\Element\Factory $factoryElement
@@ -43,6 +56,7 @@ class BaseImage extends \Magento\Framework\Data\Form\Element\AbstractElement
4356
* @param \Magento\Backend\Model\UrlFactory $backendUrlFactory
4457
* @param \Magento\Catalog\Helper\Data $catalogData
4558
* @param \Magento\Framework\File\Size $fileConfig
59+
* @param \Magento\Framework\View\LayoutInterface $layout
4660
* @param array $data
4761
*/
4862
public function __construct(
@@ -53,15 +67,17 @@ public function __construct(
5367
\Magento\Backend\Model\UrlFactory $backendUrlFactory,
5468
\Magento\Catalog\Helper\Data $catalogData,
5569
\Magento\Framework\File\Size $fileConfig,
70+
\Magento\Framework\View\LayoutInterface $layout,
5671
array $data = []
5772
) {
5873
parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
5974

60-
$this->_assetRepo = $assetRepo;
61-
$this->_url = $backendUrlFactory->create();
62-
$this->_catalogHelperData = $catalogData;
63-
$this->_fileConfig = $fileConfig;
64-
$this->_maxFileSize = $this->_getFileMaxSize();
75+
$this->assetRepo = $assetRepo;
76+
$this->url = $backendUrlFactory->create();
77+
$this->catalogHelperData = $catalogData;
78+
$this->fileConfig = $fileConfig;
79+
$this->maxFileSize = $this->getFileMaxSize();
80+
$this->layout = $layout;
6581
}
6682

6783
/**
@@ -71,7 +87,7 @@ public function __construct(
7187
*/
7288
public function getLabel()
7389
{
74-
return __('Images');
90+
return __('Images and Videos');
7591
}
7692

7793
/**
@@ -81,66 +97,46 @@ public function getLabel()
8197
*/
8298
public function getElementHtml()
8399
{
84-
$htmlId = $this->_escaper->escapeHtml($this->getHtmlId());
85-
$uploadUrl = $this->_escaper->escapeHtml($this->_getUploadUrl());
86-
$spacerImage = $this->_assetRepo->getUrl('images/spacer.gif');
87-
$imagePlaceholderText = __('Click here or drag and drop to add images.');
88-
$deleteImageText = __('Delete image');
89-
$makeBaseText = __('Make Base');
90-
$hiddenText = __('Hidden');
91-
$imageManagementText = __('Image Management');
92-
/** @var $product \Magento\Catalog\Model\Product */
93-
$html = <<<HTML
94-
<div id="{$htmlId}-container" class="images"
95-
data-mage-init='{"baseImage":{}}'
96-
data-max-file-size="{$this->_getFileMaxSize()}"
97-
>
98-
<div class="image image-placeholder">
99-
<input type="file" name="image" data-url="{$uploadUrl}" multiple="multiple" />
100-
<img class="spacer" src="{$spacerImage}"/>
101-
<p class="image-placeholder-text">{$imagePlaceholderText}</p>
102-
</div>
103-
<script id="{$htmlId}-template" data-template="image" type="text/x-magento-template">
104-
<div class="image">
105-
<img class="spacer" src="{$spacerImage}"/>
106-
<img
107-
class="product-image"
108-
src="<%- data.url %>"
109-
data-position="<%- data.position %>"
110-
alt="<%- data.label %>" />
111-
<div class="actions">
112-
<button type="button" class="action-delete" data-role="delete-button" title="{$deleteImageText}">
113-
<span>{$deleteImageText}</span>
114-
</button>
115-
<button type="button" class="action-make-base" data-role="make-base-button" title="{$makeBaseText}">
116-
<span>{$makeBaseText}</span>
117-
</button>
118-
<div class="draggable-handle"></div>
119-
</div>
120-
<div class="image-label"></div>
121-
<div class="image-fade"><span>{$hiddenText}</span></div>
122-
</div>
123-
</script>
124-
</div>
125-
<span class="action-manage-images" data-activate-tab="image-management">
126-
<span>{$imageManagementText}</span>
127-
</span>
128-
<script>
129-
require([
130-
'jquery'
131-
],function($){
132-
133-
'use strict';
134-
135-
$('[data-activate-tab=image-management]')
136-
.on('click.toggleImageManagementTab', function() {
137-
$('#product_info_tabs_image-management').trigger('click');
138-
});
139-
});
140-
</script>
141-
142-
HTML;
143-
return $html;
100+
$block = $this->createElementHtmlOutputBlock();
101+
$this->assignBlockVariables($block);
102+
return $block->toHtml();
103+
}
104+
105+
/**
106+
* @param \Magento\Framework\View\Element\Template $block
107+
* @return \Magento\Framework\View\Element\Template
108+
*/
109+
public function assignBlockVariables(\Magento\Framework\View\Element\Template $block)
110+
{
111+
$block->assign([
112+
'htmlId' => $this->_escaper->escapeHtml($this->getHtmlId()),
113+
'fileMaxSize' => $this->maxFileSize,
114+
'uploadUrl' => $this->_escaper->escapeHtml($this->_getUploadUrl()),
115+
'spacerImage' => $this->assetRepo->getUrl('images/spacer.gif'),
116+
'imagePlaceholderText' => __('Click here or drag and drop to add images.'),
117+
'deleteImageText' => __('Delete image'),
118+
'makeBaseText' => __('Make Base'),
119+
'hiddenText' => __('Hidden'),
120+
'imageManagementText' => __('Images and Videos'),
121+
]);
122+
123+
return $block;
124+
}
125+
126+
127+
/**
128+
* @return \Magento\Framework\View\Element\Template
129+
*/
130+
public function createElementHtmlOutputBlock()
131+
{
132+
/** @var \Magento\Framework\View\Element\Template $block */
133+
$block = $this->layout->createBlock(
134+
'Magento\Framework\View\Element\Template',
135+
'product.details.form.base.image.element'
136+
);
137+
$block->setTemplate(self::ELEMENT_OUTPUT_TEMPLATE);
138+
139+
return $block;
144140
}
145141

146142
/**
@@ -150,16 +146,16 @@ class="product-image"
150146
*/
151147
protected function _getUploadUrl()
152148
{
153-
return $this->_url->getUrl('catalog/product_gallery/upload');
149+
return $this->url->getUrl('catalog/product_gallery/upload');
154150
}
155151

156152
/**
157153
* Get maximum file size to upload in bytes
158154
*
159155
* @return int
160156
*/
161-
protected function _getFileMaxSize()
157+
protected function getFileMaxSize()
162158
{
163-
return $this->_fileConfig->getMaxFileSize();
159+
return $this->fileConfig->getMaxFileSize();
164160
}
165161
}

0 commit comments

Comments
 (0)