Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-config
Model
Config
Structure
Mapper
Sorting.php
Go to the documentation of this file.
1
<?php
10
namespace
Magento\Config\Model\Config\Structure\Mapper
;
11
16
class
Sorting
extends
\Magento\Config\Model\Config\Structure\AbstractMapper
17
{
24
public
function
map
(array
$data
)
25
{
26
foreach
(
$data
[
'config'
][
'system'
] as &
$element
) {
27
$element
= $this->
_processConfig
($element);
28
}
29
return
$data
;
30
}
31
36
protected
function
_processConfig
(
$data
)
37
{
38
foreach
(
$data
as &
$item
) {
39
if
($this->
_hasValue
(
'children'
, $item)) {
40
$item
[
'children'
] = $this->
_processConfig
($item[
'children'
]);
41
}
42
}
43
uasort(
$data
, [$this,
'_cmp'
]);
44
return
$data
;
45
}
46
54
protected
function
_cmp
($elementA, $elementB)
55
{
56
$sortIndexA = 0;
57
if
($this->
_hasValue
(
'sortOrder'
, $elementA)) {
58
$sortIndexA = (float)$elementA[
'sortOrder'
];
59
}
60
$sortIndexB = 0;
61
if
($this->
_hasValue
(
'sortOrder'
, $elementB)) {
62
$sortIndexB = (float)$elementB[
'sortOrder'
];
63
}
64
65
if
($sortIndexA == $sortIndexB) {
66
return
0;
67
}
68
69
return
$sortIndexA < $sortIndexB ? -1 : 1;
70
}
71
}
Magento\Config\Model\Config\Structure\Mapper\Sorting\map
map(array $data)
Definition:
Sorting.php:24
$item
$item
Definition:
partial_invoice.php:27
Magento\Config\Model\Config\Structure\Mapper\Sorting
Definition:
Sorting.php:16
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Config\Model\Config\Structure\Mapper\Sorting\_cmp
_cmp($elementA, $elementB)
Definition:
Sorting.php:54
Magento\Config\Model\Config\Structure\AbstractMapper\_hasValue
_hasValue($key, $target)
Definition:
AbstractMapper.php:25
Magento\Config\Model\Config\Structure\Mapper
Magento\Config\Model\Config\Structure\Mapper\Sorting\_processConfig
_processConfig($data)
Definition:
Sorting.php:36
$element
$element
Definition:
element.phtml:12