Skip to content

Commit 5077285

Browse files
committed
Merge remote-tracking branch 'origin/AC-13054' into spartans_pr_11122024
2 parents 6b71ca9 + b948d35 commit 5077285

File tree

3 files changed

+46
-4
lines changed

3 files changed

+46
-4
lines changed

app/code/Magento/Backend/view/adminhtml/ui_component/design_config_listing.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
@@ -16,5 +16,10 @@
1616
<label translate="true">Theme Name</label>
1717
</settings>
1818
</column>
19+
<column name="short_description" sortOrder="45">
20+
<settings>
21+
<label translate="true">Short Description</label>
22+
</settings>
23+
</column>
1924
</columns>
2025
</listing>

app/code/Magento/Theme/Ui/Component/Design/Config/DataProvider.php

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Theme\Ui\Component\Design\Config;
77

88
use Magento\Framework\Api\FilterBuilder;
99
use Magento\Framework\Api\Search\ReportingInterface;
1010
use Magento\Framework\Api\Search\SearchCriteriaBuilder;
1111
use Magento\Framework\App\RequestInterface;
12+
use Magento\Framework\App\ResourceConnection;
1213
use Magento\Store\Model\StoreManagerInterface;
1314

1415
/**
@@ -25,6 +26,11 @@ class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvi
2526
*/
2627
protected $storeManager;
2728

29+
/**
30+
* @var ResourceConnection
31+
*/
32+
private $resourceConnection;
33+
2834
/**
2935
* @param string $name
3036
* @param string $primaryFieldName
@@ -34,6 +40,7 @@ class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvi
3440
* @param RequestInterface $request
3541
* @param FilterBuilder $filterBuilder
3642
* @param StoreManagerInterface $storeManager
43+
* @param ResourceConnection $resourceConnection
3744
* @param array $meta
3845
* @param array $data
3946
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -47,6 +54,7 @@ public function __construct(
4754
RequestInterface $request,
4855
FilterBuilder $filterBuilder,
4956
StoreManagerInterface $storeManager,
57+
ResourceConnection $resourceConnection,
5058
array $meta = [],
5159
array $data = []
5260
) {
@@ -62,6 +70,7 @@ public function __construct(
6270
$data
6371
);
6472
$this->storeManager = $storeManager;
73+
$this->resourceConnection = $resourceConnection;
6574
}
6675

6776
/**
@@ -87,11 +96,38 @@ public function getData()
8796
->create()
8897
);
8998
}
99+
100+
$themeConfigData = $this->getCoreConfigData();
90101
$data = parent::getData();
91102
foreach ($data['items'] as & $item) {
92103
$item += ['default' => __('Global')];
104+
105+
$scope = ($item['store_id']) ? 'stores' : (($item['store_website_id']) ? 'websites' : 'default');
106+
$scopeId = (int) $item['store_website_id'] ?? 0;
107+
$themeId = (int) $item['theme_theme_id'] ?? 0;
108+
109+
$criteria = ['scope' => $scope, 'scope_id' => $scopeId, 'value' => $themeId];
110+
$configData = array_filter($themeConfigData, function ($themeConfig) use ($criteria) {
111+
return array_intersect_assoc($criteria, $themeConfig) === $criteria;
112+
});
113+
114+
$item += ['short_description' => !$configData ? __('Using Default Theme') : ''];
93115
}
94116

95117
return $data;
96118
}
119+
120+
/**
121+
* Get the core config data related to theme
122+
*
123+
* @return array
124+
*/
125+
private function getCoreConfigData(): array
126+
{
127+
$connection = $this->resourceConnection->getConnection();
128+
return $connection->fetchAll(
129+
$connection->select()->from($connection->getTableName('core_config_data'))
130+
->where('path = ?', 'design/theme/theme_id')
131+
);
132+
}
97133
}

app/code/Magento/Theme/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,4 @@ ID,ID
193193
View,View
194194
Action,Action
195195
"Display Report Bugs Link","Display Report Bugs Link"
196+
"Using Default Theme","Using Default Theme"

0 commit comments

Comments
 (0)