Skip to content

Commit 096eb84

Browse files
author
Joan He
committed
Merge remote-tracking branch 'upstream/2.3-develop' into MAGETWO-85063-curl
# Conflicts: # composer.lock
2 parents c64a54b + 2c0a91c commit 096eb84

File tree

756 files changed

+11900
-3101
lines changed

Some content is hidden

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

756 files changed

+11900
-3101
lines changed

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ atlassian*
3434
/.php_cs.cache
3535
/grunt-config.json
3636
/dev/tools/grunt/configs/local-themes.js
37-
3837
/pub/media/*.*
3938
!/pub/media/.htaccess
4039
/pub/media/attribute/*

Diff for: app/code/Magento/Backend/view/adminhtml/layout/editor.xml

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@
1010
<link src="Magento_Backend::js/bootstrap/editor.js"/>
1111
<css src="prototype/windows/themes/default.css"/>
1212
</head>
13-
<body/>
1413
</page>

Diff for: app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
<?php if ($block->getButtonsHtml('header')): ?>
1313
<div class="page-form-actions" <?= /* @escapeNotVerified */ $block->getUiId('content-header') ?>><?= $block->getButtonsHtml('header') ?></div>
1414
<?php endif; ?>
15+
<?php if ($block->getButtonsHtml('toolbar')): ?>
16+
<div class="page-main-actions">
17+
<div class="page-actions">
18+
<div class="page-actions-buttons">
19+
<?= $block->getButtonsHtml('toolbar') ?>
20+
</div>
21+
</div>
22+
</div>
23+
<?php endif; ?>
1524
<?= $block->getFormHtml() ?>
1625
<?php if ($block->hasFooterButtons()): ?>
1726
<div class="content-footer">

Diff for: app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@
6262
<label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label>
6363
<script>
6464
require([
65-
'tinymce'
65+
'tinymceDeprecated'
6666
], function(tinyMCE){
67+
6768
tinyMCE.init({
6869
mode : "exact",
6970
theme : "advanced",

Diff for: app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php

+1-13
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,7 @@ public function getAfterElementHtml()
102102
var config = $config,
103103
editor;
104104
105-
jQuery.extend(config, {
106-
settings: {
107-
theme_advanced_buttons1 : 'bold,italic,|,justifyleft,justifycenter,justifyright,|,' +
108-
'fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code',
109-
theme_advanced_buttons2: null,
110-
theme_advanced_buttons3: null,
111-
theme_advanced_buttons4: null,
112-
theme_advanced_statusbar_location: null
113-
},
114-
files_browser_window_url: false
115-
});
116-
117-
editor = new tinyMceWysiwygSetup(
105+
editor = new wysiwygSetup(
118106
'{$this->getHtmlId()}',
119107
config
120108
);

Diff for: app/code/Magento/Catalog/Controller/Adminhtml/Category/Add.php

-5
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ public function execute()
7171
$resultPage->getConfig()->getTitle()->prepend(__('New Category'));
7272
$resultPage->addBreadcrumb(__('Manage Catalog Categories'), __('Manage Categories'));
7373

74-
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
75-
if ($block) {
76-
$block->setStoreId(0);
77-
}
78-
7974
return $resultPage;
8075
}
8176
}

Diff for: app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php

-5
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ public function execute()
105105
$resultPage->getConfig()->getTitle()->prepend($resultPageTitle);
106106
$resultPage->addBreadcrumb(__('Manage Catalog Categories'), __('Manage Categories'));
107107

108-
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
109-
if ($block) {
110-
$block->setStoreId($storeId);
111-
}
112-
113108
return $resultPage;
114109
}
115110

Diff for: app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

+76-51
Original file line numberDiff line numberDiff line change
@@ -7,75 +7,93 @@
77

88
namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute;
99

10+
use Magento\Backend\App\Action\Context;
11+
use Magento\Backend\Model\View\Result\Redirect;
12+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
13+
use Magento\Catalog\Controller\Adminhtml\Product\Attribute;
14+
use Magento\Catalog\Helper\Product;
15+
use Magento\Catalog\Model\Product\AttributeSet\BuildFactory;
16+
use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory;
17+
use Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\Validator;
18+
use Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory;
19+
use Magento\Eav\Model\Entity\Attribute\Set;
20+
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;
21+
use Magento\Framework\Cache\FrontendInterface;
22+
use Magento\Framework\Controller\Result\Json;
1023
use Magento\Framework\Controller\ResultFactory;
1124
use Magento\Framework\Exception\AlreadyExistsException;
25+
use Magento\Framework\Exception\LocalizedException;
26+
use Magento\Framework\Filter\FilterManager;
27+
use Magento\Framework\Registry;
28+
use Magento\Framework\View\LayoutFactory;
29+
use Magento\Framework\View\Result\PageFactory;
1230

1331
/**
1432
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1533
*/
16-
class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute
34+
class Save extends Attribute
1735
{
1836
/**
19-
* @var \Magento\Catalog\Model\Product\AttributeSet\BuildFactory
37+
* @var BuildFactory
2038
*/
2139
protected $buildFactory;
2240

2341
/**
24-
* @var \Magento\Framework\Filter\FilterManager
42+
* @var FilterManager
2543
*/
2644
protected $filterManager;
2745

2846
/**
29-
* @var \Magento\Catalog\Helper\Product
47+
* @var Product
3048
*/
3149
protected $productHelper;
3250

3351
/**
34-
* @var \Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory
52+
* @var AttributeFactory
3553
*/
3654
protected $attributeFactory;
3755

3856
/**
39-
* @var \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory
57+
* @var ValidatorFactory
4058
*/
4159
protected $validatorFactory;
4260

4361
/**
44-
* @var \Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory
62+
* @var CollectionFactory
4563
*/
4664
protected $groupCollectionFactory;
4765

4866
/**
49-
* @var \Magento\Framework\View\LayoutFactory
67+
* @var LayoutFactory
5068
*/
5169
private $layoutFactory;
5270

5371
/**
54-
* @param \Magento\Backend\App\Action\Context $context
55-
* @param \Magento\Framework\Cache\FrontendInterface $attributeLabelCache
56-
* @param \Magento\Framework\Registry $coreRegistry
57-
* @param \Magento\Catalog\Model\Product\AttributeSet\BuildFactory $buildFactory
58-
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
59-
* @param \Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory $attributeFactory
60-
* @param \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory $validatorFactory
61-
* @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory
62-
* @param \Magento\Framework\Filter\FilterManager $filterManager
63-
* @param \Magento\Catalog\Helper\Product $productHelper
64-
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
72+
* @param Context $context
73+
* @param FrontendInterface $attributeLabelCache
74+
* @param Registry $coreRegistry
75+
* @param BuildFactory $buildFactory
76+
* @param PageFactory $resultPageFactory
77+
* @param AttributeFactory $attributeFactory
78+
* @param ValidatorFactory $validatorFactory
79+
* @param CollectionFactory $groupCollectionFactory
80+
* @param FilterManager $filterManager
81+
* @param Product $productHelper
82+
* @param LayoutFactory $layoutFactory
6583
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6684
*/
6785
public function __construct(
68-
\Magento\Backend\App\Action\Context $context,
69-
\Magento\Framework\Cache\FrontendInterface $attributeLabelCache,
70-
\Magento\Framework\Registry $coreRegistry,
71-
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
72-
\Magento\Catalog\Model\Product\AttributeSet\BuildFactory $buildFactory,
73-
\Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory $attributeFactory,
74-
\Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory $validatorFactory,
75-
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory,
76-
\Magento\Framework\Filter\FilterManager $filterManager,
77-
\Magento\Catalog\Helper\Product $productHelper,
78-
\Magento\Framework\View\LayoutFactory $layoutFactory
86+
Context $context,
87+
FrontendInterface $attributeLabelCache,
88+
Registry $coreRegistry,
89+
PageFactory $resultPageFactory,
90+
BuildFactory $buildFactory,
91+
AttributeFactory $attributeFactory,
92+
ValidatorFactory $validatorFactory,
93+
CollectionFactory $groupCollectionFactory,
94+
FilterManager $filterManager,
95+
Product $productHelper,
96+
LayoutFactory $layoutFactory
7997
) {
8098
parent::__construct($context, $attributeLabelCache, $coreRegistry, $resultPageFactory);
8199
$this->buildFactory = $buildFactory;
@@ -88,7 +106,7 @@ public function __construct(
88106
}
89107

90108
/**
91-
* @return \Magento\Backend\Model\View\Result\Redirect
109+
* @return Redirect
92110
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
93111
* @SuppressWarnings(PHPMD.NPathComplexity)
94112
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
@@ -105,32 +123,43 @@ public function execute()
105123
$name = trim($name);
106124

107125
try {
108-
/** @var $attributeSet \Magento\Eav\Model\Entity\Attribute\Set */
126+
/** @var $attributeSet Set */
109127
$attributeSet = $this->buildFactory->create()
110128
->setEntityTypeId($this->_entityTypeId)
111129
->setSkeletonId($setId)
112130
->setName($name)
113131
->getAttributeSet();
114132
} catch (AlreadyExistsException $alreadyExists) {
115-
$this->messageManager->addError(__('An attribute set named \'%1\' already exists.', $name));
133+
$this->messageManager->addErrorMessage(__('An attribute set named \'%1\' already exists.', $name));
116134
$this->_session->setAttributeData($data);
117135
return $this->returnResult('catalog/*/edit', ['_current' => true], ['error' => true]);
118-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
119-
$this->messageManager->addError($e->getMessage());
136+
} catch (LocalizedException $e) {
137+
$this->messageManager->addErrorMessage($e->getMessage());
120138
} catch (\Exception $e) {
121-
$this->messageManager->addException($e, __('Something went wrong while saving the attribute.'));
139+
$this->messageManager->addExceptionMessage(
140+
$e,
141+
__('Something went wrong while saving the attribute.')
142+
);
122143
}
123144
}
124145

125146
$attributeId = $this->getRequest()->getParam('attribute_id');
126-
$attributeCode = $this->getRequest()->getParam('attribute_code')
127-
?: $this->generateCode($this->getRequest()->getParam('frontend_label')[0]);
147+
148+
/** @var $model ProductAttributeInterface */
149+
$model = $this->attributeFactory->create();
150+
if ($attributeId) {
151+
$model->load($attributeId);
152+
}
153+
$attributeCode = $model && $model->getId()
154+
? $model->getAttributeCode()
155+
: $this->getRequest()->getParam('attribute_code');
156+
$attributeCode = $attributeCode ?: $this->generateCode($this->getRequest()->getParam('frontend_label')[0]);
128157
if (strlen($attributeCode) > 0) {
129158
$validatorAttrCode = new \Zend_Validate_Regex(
130159
['pattern' => '/^[a-z\x{600}-\x{6FF}][a-z\x{600}-\x{6FF}_0-9]{0,30}$/u']
131160
);
132161
if (!$validatorAttrCode->isValid($attributeCode)) {
133-
$this->messageManager->addError(
162+
$this->messageManager->addErrorMessage(
134163
__(
135164
'Attribute code "%1" is invalid. Please use only letters (a-z), ' .
136165
'numbers (0-9) or underscore(_) in this field, first character should be a letter.',
@@ -148,11 +177,11 @@ public function execute()
148177

149178
//validate frontend_input
150179
if (isset($data['frontend_input'])) {
151-
/** @var $inputType \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\Validator */
180+
/** @var $inputType Validator */
152181
$inputType = $this->validatorFactory->create();
153182
if (!$inputType->isValid($data['frontend_input'])) {
154183
foreach ($inputType->getMessages() as $message) {
155-
$this->messageManager->addError($message);
184+
$this->messageManager->addErrorMessage($message);
156185
}
157186
return $this->returnResult(
158187
'catalog/*/edit',
@@ -162,18 +191,14 @@ public function execute()
162191
}
163192
}
164193

165-
/* @var $model \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
166-
$model = $this->attributeFactory->create();
167-
168194
if ($attributeId) {
169-
$model->load($attributeId);
170195
if (!$model->getId()) {
171-
$this->messageManager->addError(__('This attribute no longer exists.'));
196+
$this->messageManager->addErrorMessage(__('This attribute no longer exists.'));
172197
return $this->returnResult('catalog/*/', [], ['error' => true]);
173198
}
174199
// entity type check
175200
if ($model->getEntityTypeId() != $this->_entityTypeId) {
176-
$this->messageManager->addError(__('We can\'t update the attribute.'));
201+
$this->messageManager->addErrorMessage(__('We can\'t update the attribute.'));
177202
$this->_session->setAttributeData($data);
178203
return $this->returnResult('catalog/*/', [], ['error' => true]);
179204
}
@@ -193,7 +218,7 @@ public function execute()
193218
);
194219
}
195220

196-
$data += ['is_filterable' => 0, 'is_filterable_in_search' => 0, 'apply_to' => []];
221+
$data += ['is_filterable' => 0, 'is_filterable_in_search' => 0];
197222

198223
if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) {
199224
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
@@ -241,7 +266,7 @@ public function execute()
241266

242267
try {
243268
$model->save();
244-
$this->messageManager->addSuccess(__('You saved the product attribute.'));
269+
$this->messageManager->addSuccessMessage(__('You saved the product attribute.'));
245270

246271
$this->_attributeLabelCache->clean();
247272
$this->_session->setAttributeData(false);
@@ -265,7 +290,7 @@ public function execute()
265290
}
266291
return $this->returnResult('catalog/*/', [], ['error' => false]);
267292
} catch (\Exception $e) {
268-
$this->messageManager->addError($e->getMessage());
293+
$this->messageManager->addErrorMessage($e->getMessage());
269294
$this->_session->setAttributeData($data);
270295
return $this->returnResult(
271296
'catalog/*/edit',
@@ -281,7 +306,7 @@ public function execute()
281306
* @param string $path
282307
* @param array $params
283308
* @param array $response
284-
* @return \Magento\Framework\Controller\Result\Json|\Magento\Backend\Model\View\Result\Redirect
309+
* @return Json|Redirect
285310
*/
286311
private function returnResult($path = '', array $params = [], array $response = [])
287312
{

Diff for: app/code/Magento/Catalog/Controller/Adminhtml/Product/Edit.php

-5
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ public function execute()
8484
);
8585
}
8686

87-
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
88-
if ($block) {
89-
$block->setStoreId($product->getStoreId());
90-
}
91-
9287
return $resultPage;
9388
}
9489
}

Diff for: app/code/Magento/Catalog/Controller/Adminhtml/Product/NewAction.php

-5
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ public function execute()
7373
$resultPage->getConfig()->getTitle()->prepend(__('New Product'));
7474
}
7575

76-
$block = $resultPage->getLayout()->getBlock('catalog.wysiwyg.js');
77-
if ($block) {
78-
$block->setStoreId($product->getStoreId());
79-
}
80-
8176
return $resultPage;
8277
}
8378
}

Diff for: app/code/Magento/Catalog/Helper/Data.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,7 @@ public function isUsingStaticUrlsAllowed()
435435
{
436436
return $this->scopeConfig->isSetFlag(
437437
self::CONFIG_USE_STATIC_URLS,
438-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
439-
$this->_storeId
438+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
440439
);
441440
}
442441

0 commit comments

Comments
 (0)