Skip to content

Commit 3d6df07

Browse files
author
Andrey Konosov
committed
Merge remote-tracking branch 'main/develop' into MX_GITHUB
2 parents 0e92b98 + 4fd68c3 commit 3d6df07

File tree

136 files changed

+8072
-2151
lines changed

Some content is hidden

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

136 files changed

+8072
-2151
lines changed

app/code/Magento/Cms/Model/Block/DataProvider.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Cms\Model\Resource\Block\Collection;
99
use Magento\Cms\Model\Resource\Block\CollectionFactory;
1010
use Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface;
11+
use Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool;
1112

1213
/**
1314
* Class DataProvider
@@ -48,11 +49,17 @@ class DataProvider implements DataProviderInterface
4849
*/
4950
protected $data = [];
5051

52+
/**
53+
* @var FilterPool
54+
*/
55+
protected $filterPool;
56+
5157
/**
5258
* @param string $name
5359
* @param string $primaryFieldName
5460
* @param string $requestFieldName
5561
* @param CollectionFactory $collectionFactory
62+
* @param FilterPool $filterPool
5663
* @param array $meta
5764
* @param array $data
5865
*/
@@ -61,13 +68,15 @@ public function __construct(
6168
$primaryFieldName,
6269
$requestFieldName,
6370
CollectionFactory $collectionFactory,
71+
FilterPool $filterPool,
6472
array $meta = [],
6573
array $data = []
6674
) {
6775
$this->name = $name;
6876
$this->primaryFieldName = $primaryFieldName;
6977
$this->requestFieldName = $requestFieldName;
7078
$this->collection = $collectionFactory->create();
79+
$this->filterPool = $filterPool;
7180
$this->meta = $meta;
7281
$this->data = $data;
7382
}
@@ -145,9 +154,9 @@ public function getFieldMetaInfo($fieldSetName, $fieldName)
145154
/**
146155
* @inheritdoc
147156
*/
148-
public function addFilter($field, $condition = null)
157+
public function addFilter($condition, $field = null, $type = 'regular')
149158
{
150-
$this->collection->addFieldToFilter($field, $condition);
159+
$this->filterPool->registerNewFilter($condition, $field, $type);
151160
}
152161

153162
/**
@@ -216,6 +225,7 @@ public function removeAllFields()
216225
*/
217226
public function getData()
218227
{
228+
$this->filterPool->applyFilters($this->collection);
219229
return $this->collection->toArray();
220230
}
221231

@@ -226,6 +236,7 @@ public function getData()
226236
*/
227237
public function count()
228238
{
239+
$this->filterPool->applyFilters($this->collection);
229240
return $this->collection->count();
230241
}
231242

app/code/Magento/Cms/Model/Page/DataProvider.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Cms\Model\Resource\Page\Collection;
99
use Magento\Cms\Model\Resource\Page\CollectionFactory;
1010
use Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface;
11+
use Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool;
1112

1213
/**
1314
* Class DataProvider
@@ -57,11 +58,17 @@ class DataProvider implements DataProviderInterface
5758
*/
5859
protected $data = [];
5960

61+
/**
62+
* @var FilterPool
63+
*/
64+
protected $filterPool;
65+
6066
/**
6167
* @param string $name
6268
* @param string $primaryFieldName
6369
* @param string $requestFieldName
6470
* @param CollectionFactory $collectionFactory
71+
* @param FilterPool $filterPool
6572
* @param array $meta
6673
* @param array $data
6774
*/
@@ -70,13 +77,14 @@ public function __construct(
7077
$primaryFieldName,
7178
$requestFieldName,
7279
CollectionFactory $collectionFactory,
80+
FilterPool $filterPool,
7381
array $meta = [],
7482
array $data = []
7583
) {
7684
$this->name = $name;
7785
$this->primaryFieldName = $primaryFieldName;
7886
$this->requestFieldName = $requestFieldName;
79-
87+
$this->filterPool = $filterPool;
8088
$this->collection = $collectionFactory->create();
8189
$this->collection->setFirstStoreFlag(true);
8290
$this->meta = $meta;
@@ -156,9 +164,9 @@ public function getFieldMetaInfo($fieldSetName, $fieldName)
156164
/**
157165
* @inheritdoc
158166
*/
159-
public function addFilter($field, $condition = null)
167+
public function addFilter($condition, $field = null, $type = 'regular')
160168
{
161-
$this->collection->addFieldToFilter($field, $condition);
169+
$this->filterPool->registerNewFilter($condition, $field, $type);
162170
}
163171

164172
/**
@@ -227,6 +235,7 @@ public function removeAllFields()
227235
*/
228236
public function getData()
229237
{
238+
$this->filterPool->applyFilters($this->collection);
230239
return $this->collection->toArray();
231240
}
232241

@@ -237,6 +246,7 @@ public function getData()
237246
*/
238247
public function count()
239248
{
249+
$this->filterPool->applyFilters($this->collection);
240250
return $this->collection->count();
241251
}
242252

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Cms\Setup;
8+
9+
use Magento\Framework\DB\Adapter\AdapterInterface;
10+
use Magento\Framework\Setup\UpgradeSchemaInterface;
11+
use Magento\Framework\Setup\ModuleContextInterface;
12+
use Magento\Framework\Setup\SchemaSetupInterface;
13+
14+
/**
15+
* @codeCoverageIgnore
16+
*/
17+
class UpgradeSchema implements UpgradeSchemaInterface
18+
{
19+
/**
20+
* {@inheritdoc}
21+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
22+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
23+
* @SuppressWarnings(PHPMD.NPathComplexity)
24+
*/
25+
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
26+
{
27+
$installer = $setup;
28+
$connection = $installer->getConnection();
29+
if (version_compare($context->getVersion(), '2.0.1') < 0) {
30+
$connection->addIndex(
31+
$installer->getTable('cms_page'),
32+
$setup->getIdxName(
33+
$installer->getTable('cms_page'),
34+
['title', 'meta_keywords', 'meta_description', 'identifier', 'content'],
35+
AdapterInterface::INDEX_TYPE_FULLTEXT
36+
),
37+
['title', 'meta_keywords', 'meta_description', 'identifier', 'content'],
38+
AdapterInterface::INDEX_TYPE_FULLTEXT
39+
);
40+
$connection->addIndex(
41+
$installer->getTable('cms_block'),
42+
$setup->getIdxName(
43+
$installer->getTable('cms_block'),
44+
['title', 'identifier', 'content'],
45+
AdapterInterface::INDEX_TYPE_FULLTEXT
46+
),
47+
['title', 'identifier', 'content'],
48+
AdapterInterface::INDEX_TYPE_FULLTEXT
49+
);
50+
}
51+
}
52+
}

app/code/Magento/Cms/Ui/DataProvider/Block/Row/Actions.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php

Lines changed: 0 additions & 73 deletions
This file was deleted.

app/code/Magento/Cms/etc/di.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,24 @@
5656
</argument>
5757
</arguments>
5858
</type>
59+
<virtualType name="CmsGirdFilterPool" type="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool">
60+
<arguments>
61+
<argument name="appliers" xsi:type="array">
62+
<item name="regular" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter</item>
63+
<item name="fulltext" xsi:type="object">Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter</item>
64+
</argument>
65+
</arguments>
66+
</virtualType>
67+
<virtualType name="PageGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
68+
<arguments>
69+
<argument name="collection" xsi:type="object" shared="false">Magento\Cms\Model\Resource\Page\Collection</argument>
70+
<argument name="filterPool" xsi:type="object" shared="false">CmsGirdFilterPool</argument>
71+
</arguments>
72+
</virtualType>
73+
<virtualType name="BlockGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
74+
<arguments>
75+
<argument name="collection" xsi:type="object" shared="false">Magento\Cms\Model\Resource\Block\Collection</argument>
76+
<argument name="filterPool" xsi:type="object" shared="false">CmsGirdFilterPool</argument>
77+
</arguments>
78+
</virtualType>
5979
</config>

app/code/Magento/Cms/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
9-
<module name="Magento_Cms" setup_version="2.0.0">
9+
<module name="Magento_Cms" setup_version="2.0.1">
1010
<sequence>
1111
<module name="Magento_Store"/>
1212
<module name="Magento_Theme"/>

app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</argument>
2424
<dataSource name="cms_block_listing_data_source">
2525
<argument name="dataProvider" xsi:type="configurableObject">
26-
<argument name="class" xsi:type="string">Magento\Cms\Model\Block\DataProvider</argument>
26+
<argument name="class" xsi:type="string">BlockGridDataProvider</argument>
2727
<argument name="name" xsi:type="string">cms_block_listing_data_source</argument>
2828
<argument name="primaryFieldName" xsi:type="string">block_id</argument>
2929
<argument name="requestFieldName" xsi:type="string">id</argument>
@@ -69,7 +69,7 @@
6969
</item>
7070
</argument>
7171
</container>
72-
<container name="search">
72+
<filterSearch name="fulltext">
7373
<argument name="data" xsi:type="array">
7474
<item name="config" xsi:type="array">
7575
<item name="component" xsi:type="string">Magento_Ui/js/grid/search/search</item>
@@ -82,7 +82,7 @@
8282
</item>
8383
</item>
8484
</argument>
85-
</container>
85+
</filterSearch>
8686
<filters name="listing_filters">
8787
<argument name="data" xsi:type="array">
8888
<item name="config" xsi:type="array">

0 commit comments

Comments
 (0)