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-ui
Component
Paging.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Ui\Component
;
7
12
class
Paging
extends
AbstractComponent
13
{
14
const
NAME
=
'paging'
;
15
21
protected
$_data
= [
22
'config'
=> [
23
'options'
=> [
24
'20'
=> [
25
'value'
=> 20,
26
'label'
=> 20
27
],
28
'30'
=> [
29
'value'
=> 30,
30
'label'
=> 30
31
],
32
'50'
=> [
33
'value'
=> 50,
34
'label'
=> 50
35
],
36
'100'
=> [
37
'value'
=> 100,
38
'label'
=> 100
39
],
40
'200'
=> [
41
'value'
=> 200,
42
'label'
=> 200
43
],
44
],
45
'pageSize'
=> 20,
46
'current'
=> 1
47
]
48
];
49
55
public
function
getComponentName
()
56
{
57
return
static::NAME;
58
}
59
65
public
function
prepare
()
66
{
67
$this->
prepareOptions
();
68
$paging = $this->
getContext
()->getRequestParam(
'paging'
);
69
if
(!isset($paging[
'notLimits'
])) {
70
$this->
getContext
()
71
->getDataProvider()
72
->setLimit($this->
getOffset
($paging), $this->
getSize
($paging));
73
}
74
75
parent::prepare();
76
}
77
83
protected
function
prepareOptions
()
84
{
85
$config
= $this->
getData
(
'config'
);
86
if
(isset(
$config
[
'options'
])) {
87
$config
[
'options'
] = array_values(
$config
[
'options'
]);
88
foreach
(
$config
[
'options'
] as &
$item
) {
89
$item
[
'value'
] = (int)
$item
[
'value'
];
90
}
91
unset(
$item
);
92
$this->
setData
(
'config'
,
$config
);
93
}
94
}
95
102
protected
function
getOffset
($paging)
103
{
104
$defaultPage = $this->
getData
(
'config/current'
) ?: 1;
105
return
(
int
) (isset($paging[
'current'
]) ? $paging[
'current'
] : $defaultPage);
106
}
107
114
protected
function
getSize
($paging)
115
{
116
$defaultLimit = $this->
getData
(
'config/pageSize'
) ?: 20;
117
return
(
int
) (isset($paging[
'pageSize'
]) ? $paging[
'pageSize'
] : $defaultLimit);
118
}
119
}
Magento\Ui\Component\AbstractComponent
Definition:
AbstractComponent.php:24
Magento\Ui\Component\AbstractComponent\getData
getData($key='', $index=null)
Definition:
AbstractComponent.php:264
$config
$config
Definition:
fraud_order.php:17
Magento\Ui\Component\Paging\NAME
const NAME
Definition:
Paging.php:14
Magento\Ui\Component\AbstractComponent\setData
setData($key, $value=null)
Definition:
AbstractComponent.php:252
$item
$item
Definition:
partial_invoice.php:27
Magento\Ui\Component\AbstractComponent\getContext
getContext()
Definition:
AbstractComponent.php:71
Magento\Ui\Component\Paging\getComponentName
getComponentName()
Definition:
Paging.php:55
Magento\Ui\Component\Paging\prepareOptions
prepareOptions()
Definition:
Paging.php:83
Magento\Ui\Component\Paging
Definition:
Paging.php:12
Magento\Ui\Component\Paging\$_data
$_data
Definition:
Paging.php:21
Magento\Ui\Component\Paging\prepare
prepare()
Definition:
Paging.php:65
Magento\Ui\Component\Paging\getSize
getSize($paging)
Definition:
Paging.php:114
Magento\Ui\Component\Paging\getOffset
getOffset($paging)
Definition:
Paging.php:102
Magento\Ui\Component
Definition:
ConfigurationTest.php:6