File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+ declare (strict_types=1 );
7+
8+ namespace Magento \Theme \Plugin \Data ;
9+
10+ /**
11+ * Plugin to return real current page even if it greater then collection size.
12+ *
13+ * It is necessary to return no values when we reached the last page for api requests
14+ */
15+ class Collection
16+ {
17+ public function afterGetCurPage (\Magento \Framework \Data \Collection $ subject , int $ result , int $ displacement = 0 )
18+ {
19+ if ($ result > $ subject ->getLastPageNumber ()) {
20+ $ result = $ subject ->getLastPageNumber ();
21+ }
22+
23+ return $ result ;
24+ }
25+
26+ }
Original file line number Diff line number Diff line change 4141 </argument >
4242 </arguments >
4343 </type >
44+ <type name =" Magento\Framework\Data\Collection" >
45+ <plugin name =" currentPageDetection" type =" Magento\Theme\Plugin\Data\Collection" />
46+ </type >
4447</config >
Original file line number Diff line number Diff line change 3737 <argument name =" filePath" xsi : type =" string" >css/critical.css</argument >
3838 </arguments >
3939 </type >
40+
41+ <type name =" Magento\Framework\Data\Collection" >
42+ <plugin name =" currentPageDetection" type =" Magento\Theme\Plugin\Data\Collection" />
43+ </type >
4044</config >
You can’t perform that action at this time.
0 commit comments