Skip to content

Commit 07bd6e5

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #16414: Fixing a Mistype Error (by @tiagosampaio) - #16716: fix _utilities.less font-size issue (by @Karlasa) - #16726: [Backport 2.3] Add spelling correction: formatedPrice to formattedPrice (by @arnoudhgz) - #16732: Resolved : no navigation-level0-item__hover__color #15848 (by @hitesh-wagento) - #16685: Updated security issues details (by @quisse) - #16717: Removed space before ending sentence. (by @sanganinamrata) - #16693: 'Allowed Countries' - get countries for scope 'default'. (by @swnsma) - #16721: Corrected return message from ProductRuleTest.php (by @sanganinamrata) - #15479: Fix newsletter subscription behaviour for registered customer. (by @nuzil) - #16566: Smallest codestyle fix in Option/Type/Text.php (by @likemusic) - #16680: Captcha: Added unit test for CheckGuestCheckoutObserver (by @rogyar) - #16704: Add sort order to user agent rules table headers (by @JRhyne) - #16554: Fix docBlock for hasInvoices(), hasShipments(), hasCreditmemos() (by @nuzil) - #16408: Fixed type hints and docs for Downloadable Samples block (by @phoenix-bjoern) - #16175: Admin tabs order not working properly (by @tiagosampaio) Fixed GitHub Issues: - #15848: no navigation-level0-item__hover__color (reported by @DanielRuf) has been fixed in #16732 by @hitesh-wagento in 2.2-develop branch Related commits: 1. 1fbc2db - #16703: User Agent Rules table headers do match content of rows. (reported by @JRhyne) has been fixed in #16704 by @JRhyne in 2.2-develop branch Related commits: 1. 1b53299 - #16174: Admin tabs order not working properly (reported by @tiagosampaio) has been fixed in #16175 by @tiagosampaio in 2.2-develop branch Related commits: 1. e0b26a7 2. 23d616d 3. 5f2cf41 4. 3252237 5. d136ac1 6. 633a751 7. f5efeee
2 parents 53eb46d + b926cd9 commit 07bd6e5

File tree

55 files changed

+508
-106
lines changed

Some content is hidden

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

55 files changed

+508
-106
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ To learn more about issue gate labels click [here](https://github.com/magento/ma
5858

5959
<h2>Reporting security issues</h2>
6060

61-
To report security vulnerabilities in Magento software or web sites, please e-mail <a href="mailto:security@magento.com">security@magento.com</a>. Please do not report security issues using GitHub. Be sure to encrypt your e-mail with our <a href="https://info2.magento.com/rs/magentoenterprise/images/security_at_magento.asc">encryption key</a> if it includes sensitive information. Learn more about reporting security issues <a href="https://magento.com/security/reporting-magento-security-issue">here</a>.
61+
To report security vulnerabilities in Magento software or web sites, please create a Bugcrowd researcher account <a href="https://bugcrowd.com/magento">there</a> to submit and follow-up your issue. Learn more about reporting security issues <a href="https://magento.com/security/reporting-magento-security-issue">here</a>.
6262

6363
Stay up-to-date on the latest security news and patches for Magento by signing up for <a href="https://magento.com/security/sign-up">Security Alert Notifications</a>.
6464

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function render(DataObject $row)
5858
$result .= $this->getColumn()->getEditOnly() ? ''
5959
: '<span class="admin__grid-control-value">' . $this->_getValue($row) . '</span>';
6060

61-
return $result . $this->_getInputValueElement($row) . '</div>' ;
61+
return $result . $this->_getInputValueElement($row) . '</div>';
6262
}
6363
return $this->_getValue($row);
6464
}

app/code/Magento/Backend/Block/Widget/Tabs.php

Lines changed: 94 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public function addTab($tabId, $tab)
117117
if (empty($tabId)) {
118118
throw new \Exception(__('Please correct the tab configuration and try again. Tab Id should be not empty'));
119119
}
120+
120121
if (is_array($tab)) {
121122
$this->_tabs[$tabId] = new \Magento\Framework\DataObject($tab);
122123
} elseif ($tab instanceof \Magento\Framework\DataObject) {
@@ -126,13 +127,15 @@ public function addTab($tabId, $tab)
126127
}
127128
} elseif (is_string($tab)) {
128129
$this->_addTabByName($tab, $tabId);
130+
129131
if (!$this->_tabs[$tabId] instanceof TabInterface) {
130132
unset($this->_tabs[$tabId]);
131133
return $this;
132134
}
133135
} else {
134136
throw new \Exception(__('Please correct the tab configuration and try again.'));
135137
}
138+
136139
if ($this->_tabs[$tabId]->getUrl() === null) {
137140
$this->_tabs[$tabId]->setUrl('#');
138141
}
@@ -143,10 +146,7 @@ public function addTab($tabId, $tab)
143146

144147
$this->_tabs[$tabId]->setId($tabId);
145148
$this->_tabs[$tabId]->setTabId($tabId);
146-
147-
if ($this->_activeTab === null) {
148-
$this->_activeTab = $tabId;
149-
}
149+
150150
if (true === $this->_tabs[$tabId]->getActive()) {
151151
$this->setActiveTab($tabId);
152152
}
@@ -235,33 +235,108 @@ protected function _setActiveTab($tabId)
235235
*/
236236
protected function _beforeToHtml()
237237
{
238+
$this->_tabs = $this->reorderTabs();
239+
238240
if ($activeTab = $this->getRequest()->getParam('active_tab')) {
239241
$this->setActiveTab($activeTab);
240242
} elseif ($activeTabId = $this->_authSession->getActiveTabId()) {
241243
$this->_setActiveTab($activeTabId);
242244
}
243245

244-
$_new = [];
246+
if ($this->_activeTab === null && !empty($this->_tabs)) {
247+
/** @var TabInterface $tab */
248+
$this->_activeTab = (reset($this->_tabs))->getId();
249+
}
250+
251+
$this->assign('tabs', $this->_tabs);
252+
return parent::_beforeToHtml();
253+
}
254+
255+
/**
256+
* Reorder the tabs.
257+
*
258+
* @return array
259+
*/
260+
private function reorderTabs()
261+
{
262+
$orderByIdentity = [];
263+
$orderByPosition = [];
264+
$position = 100;
265+
266+
/**
267+
* Set the initial positions for each tab.
268+
*
269+
* @var string $key
270+
* @var TabInterface $tab
271+
*/
245272
foreach ($this->_tabs as $key => $tab) {
246-
foreach ($this->_tabs as $k => $t) {
247-
if ($t->getAfter() == $key) {
248-
$_new[$key] = $tab;
249-
$_new[$k] = $t;
250-
} else {
251-
if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($this->_tabs))) {
252-
$_new[$key] = $tab;
253-
}
254-
}
255-
}
273+
$tab->setPosition($position);
274+
275+
$orderByIdentity[$key] = $tab;
276+
$orderByPosition[$position] = $tab;
277+
278+
$position += 100;
256279
}
257280

258-
$this->_tabs = $_new;
259-
unset($_new);
281+
return $this->applyTabsCorrectOrder($orderByPosition, $orderByIdentity);
282+
}
283+
284+
/**
285+
* @param array $orderByPosition
286+
* @param array $orderByIdentity
287+
*
288+
* @return array
289+
*/
290+
private function applyTabsCorrectOrder(array $orderByPosition, array $orderByIdentity)
291+
{
292+
$positionFactor = 1;
293+
294+
/**
295+
* Rearrange the positions by using the after tag for each tab.
296+
*
297+
* @var integer $position
298+
* @var TabInterface $tab
299+
*/
300+
foreach ($orderByPosition as $position => $tab) {
301+
if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($orderByIdentity))) {
302+
$positionFactor = 1;
303+
continue;
304+
}
305+
306+
$grandPosition = $orderByIdentity[$tab->getAfter()]->getPosition();
307+
$newPosition = $grandPosition + $positionFactor;
260308

261-
$this->assign('tabs', $this->_tabs);
262-
return parent::_beforeToHtml();
309+
unset($orderByPosition[$position]);
310+
$orderByPosition[$newPosition] = $tab;
311+
$tab->setPosition($newPosition);
312+
313+
$positionFactor++;
314+
}
315+
316+
return $this->finalTabsSortOrder($orderByPosition);
263317
}
264318

319+
/**
320+
* Apply the last sort order to tabs.
321+
*
322+
* @param array $orderByPosition
323+
*
324+
* @return array
325+
*/
326+
private function finalTabsSortOrder(array $orderByPosition)
327+
{
328+
ksort($orderByPosition);
329+
330+
$ordered = [];
331+
332+
/** @var TabInterface $tab */
333+
foreach ($orderByPosition as $tab) {
334+
$ordered[$tab->getId()] = $tab;
335+
}
336+
337+
return $ordered;
338+
}
339+
265340
/**
266341
* @return string
267342
*/

app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/AbstractTestCase.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ protected function assertExecute($controllerName, $blockName)
2121
{
2222
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
2323
$outPut = "data";
24-
$resultRawMock = $this->createPartialMock(\Magento\Framework\Controller\Result\Raw::class, ['setContents'])
25-
;
24+
$resultRawMock = $this->createPartialMock(\Magento\Framework\Controller\Result\Raw::class, ['setContents']);
2625
$resultRawFactoryMock =
2726
$this->createPartialMock(\Magento\Framework\Controller\Result\RawFactory::class, ['create']);
2827
$layoutFactoryMock = $this->createPartialMock(\Magento\Framework\View\LayoutFactory::class, ['create']);

app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
</select>
9393
</formElements>
9494
</field>
95-
<actionDelete template="Magento_Backend/dynamic-rows/cells/action-delete" sortOrder="50">
95+
<actionDelete template="Magento_Backend/dynamic-rows/cells/action-delete">
9696
<argument name="data" xsi:type="array">
9797
<item name="config" xsi:type="array">
9898
<item name="fit" xsi:type="boolean">false</item>

0 commit comments

Comments
 (0)