Skip to content

Commit 5141635

Browse files
committed
Merge branch 'MAGETWO-43102' of https://github.corp.magento.com/magento-troll/magento2ce into MAGETWO-48642
Conflicts: app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php
2 parents a3aacb9 + 38d0e5c commit 5141635

File tree

176 files changed

+4347
-1811
lines changed

Some content is hidden

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

176 files changed

+4347
-1811
lines changed

.htaccess

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,6 @@
243243
order allow,deny
244244
deny from all
245245
</Files>
246-
<Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
247-
order allow,deny
248-
deny from all
249-
</Files>
250246
<Files COPYING.txt>
251247
order allow,deny
252248
deny from all

.htaccess.sample

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,6 @@
209209
order allow,deny
210210
deny from all
211211
</Files>
212-
<Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
213-
order allow,deny
214-
deny from all
215-
</Files>
216212
<Files COPYING.txt>
217213
order allow,deny
218214
deny from all

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The Magento 2 development team will review all issues and contributions submitte
1010

1111
## Contribution requirements
1212

13-
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v1.0/coding-standards/bk-coding-standards.html).
13+
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v2.0/coding-standards/bk-coding-standards.html).
1414
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request to be merged quickly and without additional clarification requests.
1515
3. Commits must be accompanied by meaningful commit messages.
1616
4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug.
@@ -25,7 +25,7 @@ The Magento 2 development team will review all issues and contributions submitte
2525
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, “fork” the Magento 2 project and be able to easily send “pull requests”.
2626

2727
1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution.
28-
2. Review the [Contributor License Agreement](https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html) if this is your first time contributing.
28+
2. Review the [Contributor License Agreement](https://magento.com/legaldocuments/mca) if this is your first time contributing.
2929
3. Create and test your work.
30-
4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v1.0/contributor-guide/CONTRIBUTING.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v1.0/contributor-guide/CONTRIBUTING.html#pull_request).
30+
4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#pull_request).
3131
5. Once your contribution is received, Magento 2 development team will review the contribution and collaborate with you as needed to improve the quality of the contribution.

CONTRIBUTOR_LICENSE_AGREEMENT.html

Lines changed: 0 additions & 137 deletions
This file was deleted.

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Longtext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function render(\Magento\Framework\DataObject $row)
3030
$truncateLength = $this->getColumn()->getTruncate();
3131
}
3232
$text = $this->filterManager->truncate(parent::_getValue($row), ['length' => $truncateLength]);
33-
if ($this->getColumn()->getEscape()) {
33+
if (!$this->getColumn()->hasEscape() || $this->getColumn()->getEscape()) {
3434
$text = $this->escapeHtml($text);
3535
}
3636
if ($this->getColumn()->getNl2br()) {

app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function execute()
100100

101101
$data['general'] = $this->getRequest()->getPostValue();
102102
$isNewCategory = !isset($data['general']['entity_id']);
103-
$data = $this->stringToBoolConverting($this->stringToBoolInputs, $data);
103+
$data = $this->stringToBoolConverting($data);
104104
$data = $this->imagePreprocessing($data);
105105
$storeId = isset($data['general']['store_id']) ? $data['general']['store_id'] : null;
106106
$parentId = isset($data['general']['parent']) ? $data['general']['parent'] : null;
@@ -234,8 +234,7 @@ public function imagePreprocessing($data)
234234
{
235235
if (!isset($_FILES) || (isset($_FILES['image']) && $_FILES['image']['name'] === '' )) {
236236
unset($data['general']['image']);
237-
if (
238-
isset($data['general']['savedImage']['delete']) &&
237+
if (isset($data['general']['savedImage']['delete']) &&
239238
$data['general']['savedImage']['delete']
240239
) {
241240
$data['general']['image']['delete'] = $data['general']['savedImage']['delete'];
@@ -247,17 +246,20 @@ public function imagePreprocessing($data)
247246
/**
248247
* Converting inputs from string to boolean
249248
*
250-
* @param array $stringToBoolInputs
251249
* @param array $data
250+
* @param array $stringToBoolInputs
252251
*
253252
* @return array
254253
*/
255-
public function stringToBoolConverting($stringToBoolInputs, $data)
254+
public function stringToBoolConverting($data, $stringToBoolInputs = null)
256255
{
256+
if (null === $stringToBoolInputs) {
257+
$stringToBoolInputs = $this->stringToBoolInputs;
258+
}
257259
foreach ($stringToBoolInputs as $key => $value) {
258260
if (is_array($value)) {
259261
if (isset($data[$key])) {
260-
$data[$key] = $this->stringToBoolConverting($value, $data[$key]);
262+
$data[$key] = $this->stringToBoolConverting($data[$key], $value);
261263
}
262264
} else {
263265
if (isset($data[$value])) {

app/code/Magento/Catalog/Model/Category/DataProvider.php

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
use Magento\Eav\Model\Config;
1212
use Magento\Eav\Model\Entity\Type;
1313
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
14+
use Magento\Store\Model\Store;
1415
use Magento\Store\Model\StoreManagerInterface;
1516
use Magento\Ui\Component\Form\Field;
1617
use Magento\Ui\DataProvider\EavValidationRules;
18+
use Magento\Catalog\Model\CategoryFactory;
19+
use Magento\Framework\Exception\NoSuchEntityException;
1720

1821
/**
1922
* Class DataProvider
@@ -22,6 +25,11 @@
2225
*/
2326
class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
2427
{
28+
/**
29+
* @var string
30+
*/
31+
protected $requestScopeFieldName = 'store';
32+
2533
/**
2634
* @var array
2735
*/
@@ -86,7 +94,7 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
8694
/**
8795
* @var \Magento\Framework\App\RequestInterface
8896
*/
89-
private $request;
97+
protected $request;
9098

9199

92100
/**
@@ -100,7 +108,12 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
100108
private $storeManager;
101109

102110
/**
103-
* Constructor
111+
* @var CategoryFactory
112+
*/
113+
private $categoryFactory;
114+
115+
/**
116+
* DataProvider constructor
104117
*
105118
* @param string $name
106119
* @param string $primaryFieldName
@@ -111,9 +124,9 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
111124
* @param \Magento\Framework\Registry $registry
112125
* @param Config $eavConfig
113126
* @param \Magento\Framework\App\RequestInterface $request
127+
* @param CategoryFactory $categoryFactory
114128
* @param array $meta
115129
* @param array $data
116-
* @throws \Magento\Framework\Exception\LocalizedException
117130
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
118131
*/
119132
public function __construct(
@@ -126,6 +139,7 @@ public function __construct(
126139
\Magento\Framework\Registry $registry,
127140
Config $eavConfig,
128141
\Magento\Framework\App\RequestInterface $request,
142+
CategoryFactory $categoryFactory,
129143
array $meta = [],
130144
array $data = []
131145
) {
@@ -136,6 +150,7 @@ public function __construct(
136150
$this->registry = $registry;
137151
$this->storeManager = $storeManager;
138152
$this->request = $request;
153+
$this->categoryFactory = $categoryFactory;
139154
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
140155
$this->meta = $this->prepareMeta($this->meta);
141156
}
@@ -282,7 +297,7 @@ protected function addUseConfigSettings($categoryData)
282297
protected function addUseDefaultSettings($category, $categoryData)
283298
{
284299
if ($category->getExistsStoreValueFlag('url_key') ||
285-
$category->getStoreId() === \Magento\Store\Model\Store::DEFAULT_STORE_ID
300+
$category->getStoreId() === Store::DEFAULT_STORE_ID
286301
) {
287302
$categoryData['use_default']['url_key'] = false;
288303
} else {
@@ -296,10 +311,25 @@ protected function addUseDefaultSettings($category, $categoryData)
296311
* Get current category
297312
*
298313
* @return Category
314+
* @throws NoSuchEntityException
299315
*/
300316
public function getCurrentCategory()
301317
{
302-
return $this->registry->registry('category');
318+
$category = $this->registry->registry('category');
319+
if ($category) {
320+
return $category;
321+
}
322+
$requestId = $this->request->getParam($this->requestFieldName);
323+
$requestScope = $this->request->getParam($this->requestScopeFieldName, Store::DEFAULT_STORE_ID);
324+
if ($requestId) {
325+
$category = $this->categoryFactory->create();
326+
$category->setStoreId($requestScope);
327+
$category->load($requestId);
328+
if (!$category->getId()) {
329+
throw NoSuchEntityException::singleField('id', $requestId);
330+
}
331+
}
332+
return $category;
303333
}
304334

305335
/**
@@ -418,14 +448,14 @@ protected function getFieldsMap()
418448
[
419449
'custom_use_parent_settings',
420450
'custom_apply_to_products',
451+
'custom_design',
421452
'page_layout',
422453
'custom_layout_update',
423454
],
424455
'schedule_design_update' =>
425456
[
426457
'custom_design_from',
427458
'custom_design_to',
428-
'custom_design',
429459
],
430460
'category_view_optimization' =>
431461
[

0 commit comments

Comments
 (0)