Skip to content

Commit bd97b9d

Browse files
author
Michael Bottens
committed
Merge remote-tracking branch 'origin/2.4-develop' into bugfix/issue-30009
2 parents d4c8d70 + 68c903f commit bd97b9d

File tree

232 files changed

+5139
-657
lines changed

Some content is hidden

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

232 files changed

+5139
-657
lines changed

.github/stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Configuration for probot-stale - https://github.com/probot/stale
22

33
# Number of days of inactivity before an Issue or Pull Request becomes stale
4-
daysUntilStale: 76
4+
daysUntilStale: 76
55

66
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
77
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
@@ -18,7 +18,7 @@ exemptLabels:
1818
- "Progress: dev in progress"
1919
- "Progress: PR in progress"
2020
- "Progress: done"
21-
- "B2B: GraphQL"
21+
- "B2B: GraphQL"
2222
- "Progress: PR Created"
2323
- "PAP"
2424
- "Project: Login as Customer"

app/code/Magento/AdminNotification/Block/ToolbarEntry.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* Toolbar entry that shows latest notifications
1111
*
1212
* @api
13-
* @author Magento Core Team <[email protected]>
1413
* @since 100.0.2
1514
*/
1615
class ToolbarEntry extends \Magento\Backend\Block\Template

app/code/Magento/AdminNotification/Model/Feed.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/**
1313
* AdminNotification Feed model
1414
*
15-
* @author Magento Core Team <[email protected]>
1615
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1716
* @api
1817
* @since 100.0.2

app/code/Magento/AdminNotification/Model/InboxInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/**
99
* AdminNotification Inbox interface
1010
*
11-
* @author Magento Core Team <[email protected]>
1211
* @api
1312
* @since 100.0.2
1413
*/

app/code/Magento/AdminNotification/Model/NotificationService.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/**
99
* Notification service model
1010
*
11-
* @author Magento Core Team <[email protected]>
1211
* @api
1312
* @since 100.0.2
1413
*/

app/code/Magento/AdminNotification/Model/ResourceModel/Grid/Collection.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
/**
88
* AdminNotification Inbox model
9-
*
10-
* @author Magento Core Team <[email protected]>
119
*/
1210
namespace Magento\AdminNotification\Model\ResourceModel\Grid;
1311

app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
* AdminNotification Inbox model
1010
*
1111
* @api
12-
* @author Magento Core Team <[email protected]>
13-
* @api
1412
* @since 100.0.2
1513
*/
1614
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection

app/code/Magento/AdminNotification/Model/ResourceModel/Inbox/Collection/Unread.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
/**
88
* Collection of unread notifications
9-
*
10-
* @author Magento Core Team <[email protected]>
119
*/
1210
namespace Magento\AdminNotification\Model\ResourceModel\Inbox\Collection;
1311

app/code/Magento/AdminNotification/Observer/PredispatchAdminActionControllerObserver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
/**
1111
* AdminNotification observer
12-
*
13-
* @author Magento Core Team <[email protected]>
12+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1413
*/
1514
class PredispatchAdminActionControllerObserver implements ObserverInterface
1615
{

app/code/Magento/AdvancedSearch/Block/Adminhtml/Search/Edit.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* Search queries relations grid container
1010
*
1111
* @api
12-
* @author Magento Core Team <[email protected]>
1312
* @since 100.0.2
1413
*/
1514
class Edit extends \Magento\Backend\Block\Widget\Grid\Container

app/code/Magento/AdvancedSearch/Block/Adminhtml/Search/Grid.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* Search query relations edit grid
1010
*
1111
* @api
12-
* @author Magento Core Team <[email protected]>
1312
* @since 100.0.2
1413
*/
1514
class Grid extends \Magento\Backend\Block\Widget\Grid

app/code/Magento/AdvancedSearch/Model/ResourceModel/Recommendations.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/**
99
* Catalog search recommendations resource model
1010
*
11-
* @author Magento Core Team <[email protected]>
1211
* @api
1312
* @since 100.0.2
1413
*/

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public function __construct(
4242
}
4343

4444
/**
45+
* Construct block
46+
*
4547
* @return void
4648
*/
4749
protected function _construct()
@@ -51,6 +53,14 @@ protected function _construct()
5153

5254
parent::_construct();
5355

56+
$this->buttonList->update('save', 'label', __('Save Attribute'));
57+
$this->buttonList->update('save', 'class', 'save primary');
58+
$this->buttonList->update(
59+
'save',
60+
'data_attribute',
61+
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
62+
);
63+
5464
if ($this->getRequest()->getParam('popup')) {
5565
$this->buttonList->remove('back');
5666
if ($this->getRequest()->getParam('product_tab') != 'variations') {
@@ -64,6 +74,8 @@ protected function _construct()
6474
100
6575
);
6676
}
77+
$this->buttonList->update('reset', 'level', 10);
78+
$this->buttonList->update('save', 'class', 'save action-secondary');
6779
} else {
6880
$this->addButton(
6981
'save_and_edit_button',
@@ -79,14 +91,6 @@ protected function _construct()
7991
);
8092
}
8193

82-
$this->buttonList->update('save', 'label', __('Save Attribute'));
83-
$this->buttonList->update('save', 'class', 'save primary');
84-
$this->buttonList->update(
85-
'save',
86-
'data_attribute',
87-
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
88-
);
89-
9094
$entityAttribute = $this->_coreRegistry->registry('entity_attribute');
9195
if (!$entityAttribute || !$entityAttribute->getIsUserDefined()) {
9296
$this->buttonList->remove('delete');
@@ -96,14 +100,14 @@ protected function _construct()
96100
}
97101

98102
/**
99-
* {@inheritdoc}
103+
* @inheritdoc
100104
*/
101105
public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
102106
{
103107
if ($this->getRequest()->getParam('popup')) {
104108
$region = 'header';
105109
}
106-
parent::addButton($buttonId, $data, $level, $sortOrder, $region);
110+
return parent::addButton($buttonId, $data, $level, $sortOrder, $region);
107111
}
108112

109113
/**

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public function getIdentities()
367367
$identities[] = $item->getIdentities();
368368
}
369369
}
370-
$identities = array_merge(...$identities);
370+
$identities = array_merge([], ...$identities);
371371

372372
return $identities;
373373
}

app/code/Magento/Catalog/Block/Product/ProductList/Related.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ public function getItems()
143143
*/
144144
public function getIdentities()
145145
{
146-
$identities = [[]];
146+
$identities = [];
147147
foreach ($this->getItems() as $item) {
148148
$identities[] = $item->getIdentities();
149149
}
150-
return array_merge(...$identities);
150+
return array_merge([], ...$identities);
151151
}
152152

153153
/**

app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ public function getItemLimit($type = '')
267267
*/
268268
public function getIdentities()
269269
{
270-
$identities = array_map(function (DataObject $item) {
271-
return $item->getIdentities();
272-
}, $this->getItems()) ?: [[]];
273-
274-
return array_merge(...$identities);
270+
$identities = [];
271+
foreach ($this->getItems() as $item) {
272+
$identities[] = $item->getIdentities();
273+
}
274+
return array_merge([], ...$identities);
275275
}
276276
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Catalog\Model\Attribute\Backend;
10+
11+
use Magento\Catalog\Model\AbstractModel;
12+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
13+
use Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend as ParentBackend;
14+
use Magento\Eav\Model\Entity\Attribute\Exception;
15+
use Magento\Framework\DataObject;
16+
use Magento\Framework\Exception\LocalizedException;
17+
use Magento\Framework\Validation\ValidationException;
18+
use Magento\Framework\Validator\HTML\WYSIWYGValidatorInterface;
19+
20+
/**
21+
* Default backend model for catalog attributes.
22+
*/
23+
class DefaultBackend extends ParentBackend
24+
{
25+
/**
26+
* @var WYSIWYGValidatorInterface
27+
*/
28+
private $wysiwygValidator;
29+
30+
/**
31+
* @param WYSIWYGValidatorInterface $wysiwygValidator
32+
*/
33+
public function __construct(WYSIWYGValidatorInterface $wysiwygValidator)
34+
{
35+
$this->wysiwygValidator = $wysiwygValidator;
36+
}
37+
38+
/**
39+
* Validate user HTML value.
40+
*
41+
* @param DataObject $object
42+
* @return void
43+
* @throws LocalizedException
44+
*/
45+
private function validateHtml(DataObject $object): void
46+
{
47+
$attribute = $this->getAttribute();
48+
$code = $attribute->getAttributeCode();
49+
if ($attribute instanceof Attribute && $attribute->getIsHtmlAllowedOnFront()) {
50+
$value = $object->getData($code);
51+
if ($value
52+
&& is_string($value)
53+
&& (!($object instanceof AbstractModel) || $object->getData($code) !== $object->getOrigData($code))
54+
) {
55+
try {
56+
$this->wysiwygValidator->validate($object->getData($code));
57+
} catch (ValidationException $exception) {
58+
$attributeException = new Exception(
59+
__(
60+
'Using restricted HTML elements for "%1". %2',
61+
$attribute->getName(),
62+
$exception->getMessage()
63+
),
64+
$exception
65+
);
66+
$attributeException->setAttributeCode($code)->setPart('backend');
67+
throw $attributeException;
68+
}
69+
}
70+
}
71+
}
72+
73+
/**
74+
* @inheritDoc
75+
*/
76+
public function beforeSave($object)
77+
{
78+
parent::beforeSave($object);
79+
$this->validateHtml($object);
80+
81+
return $this;
82+
}
83+
84+
/**
85+
* @inheritDoc
86+
*/
87+
public function validate($object)
88+
{
89+
$isValid = parent::validate($object);
90+
if ($isValid) {
91+
$this->validateHtml($object);
92+
}
93+
94+
return $isValid;
95+
}
96+
}

0 commit comments

Comments
 (0)