Skip to content

Commit 60a674f

Browse files
Yurii TorbykDooffy
authored andcommitted
MAGETWO-34122: Possibility to configure UI data provider ActionRow for CMS grid
1 parent 3526587 commit 60a674f

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ public function __construct(UrlInterface $urlBuilder)
3535
* Get data
3636
*
3737
* @param array $dataRow
38+
* @param array $data
3839
* @return mixed
3940
*/
40-
public function getData(array $dataRow)
41+
public function getData(array $dataRow, array $data = [])
4142
{
4243
return [
4344
'edit' => [
44-
'href' => $this->urlBuilder->getUrl(static::URL_PATH, ['block_id' => $dataRow['block_id']]),
45+
'href' => $this->urlBuilder->getUrl(
46+
isset($data['url_path']) ? $data['url_path'] : static::URL_PATH,
47+
['block_id' => $dataRow['block_id']]
48+
),
4549
'label' => __('Edit'),
4650
]
4751
];

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ public function __construct(UrlBuilder $actionUrlBuilder, UrlInterface $urlBuild
4545
* Get data
4646
*
4747
* @param array $dataRow
48+
* @param array $data
4849
* @return mixed
4950
*/
50-
public function getData(array $dataRow)
51+
public function getData(array $dataRow, array $data = [])
5152
{
5253
return [
5354
'edit' => [
54-
'href' => $this->urlBuilder->getUrl(static::URL_PATH, ['page_id' => $dataRow['page_id']]),
55+
'href' => $this->urlBuilder->getUrl(
56+
isset($data['url_path']) ? $data['url_path'] : static::URL_PATH,
57+
['page_id' => $dataRow['page_id']]
58+
),
5559
'label' => __('Edit'),
5660
'hidden' => true,
5761

app/code/Magento/Store/Ui/DataProvider/Row.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ public function __construct(SystemStore $systemStore, Escaper $escaper)
4444
* Get data
4545
*
4646
* @param array $dataRow
47+
* @param array $data
4748
* @return mixed
4849
*/
49-
public function getData(array $dataRow)
50+
public function getData(array $dataRow, array $data = [])
5051
{
5152
$content = '';
5253
$origStores = $dataRow['store_id'];

app/code/Magento/Ui/Component/Listing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ protected function getDataFromDataProvider(array $dataRow)
173173
{
174174
if ($this->hasData(static::ROW_DATA_PROVIDER_KEY)) {
175175
foreach ($this->getData(static::ROW_DATA_PROVIDER_KEY) as $field => $data) {
176-
$dataRow[$field] = $this->dataProviderRowPool->get($data['class'])->getData($dataRow);
176+
$dataRow[$field] = $this->dataProviderRowPool->get($data['class'])->getData($dataRow, $data);
177177
}
178178
}
179179

app/code/Magento/Ui/Component/Listing/RowInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ interface RowInterface
1414
* Get data
1515
*
1616
* @param array $dataRow
17+
* @param array $data
1718
* @return mixed
1819
*/
19-
public function getData(array $dataRow);
20+
public function getData(array $dataRow, array $data = []);
2021
}

0 commit comments

Comments
 (0)