Skip to content

Commit 47b448e

Browse files
authored
Merge pull request #9422 from magento-gl/spartans_pr_11122024
[Spartans] Bugfixes Delivery
2 parents f3e6674 + 907e7ea commit 47b448e

File tree

8 files changed

+56
-15
lines changed

8 files changed

+56
-15
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 2015 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/Catalog/Model/Product/Option/Type/Select.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Catalog\Model\Product\Option\Type;
@@ -70,6 +70,7 @@ public function __construct(
7070
* @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...)
7171
* @return $this
7272
* @throws LocalizedException
73+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
7374
*/
7475
public function validateUserValue($values)
7576
{
@@ -92,6 +93,8 @@ public function validateUserValue($values)
9293
if (!$this->_isSingleSelection()) {
9394
if (is_string($value)) {
9495
$value = explode(',', $value);
96+
} elseif (!is_array($value)) {
97+
$value = [$value];
9598
}
9699
$valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId());
97100
$valueCount = is_array($value) ? count($value) : 0;

app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ define([
5959
this.exports.value = this.provider + ':' + this.exportDataLink;
6060
},
6161

62-
/** @inheritdoc */
63-
destroy: function () {
64-
this._super();
65-
66-
this.source.remove(this.exportDataLink);
67-
},
68-
6962
/**
7063
* Get HTML array from data scope.
7164
*

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

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 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;
11+
use Magento\Framework\App\ObjectManager;
1112
use Magento\Framework\App\RequestInterface;
13+
use Magento\Framework\App\ResourceConnection;
1214
use Magento\Store\Model\StoreManagerInterface;
1315

1416
/**
@@ -25,6 +27,11 @@ class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvi
2527
*/
2628
protected $storeManager;
2729

30+
/**
31+
* @var ResourceConnection
32+
*/
33+
private $resourceConnection;
34+
2835
/**
2936
* @param string $name
3037
* @param string $primaryFieldName
@@ -36,6 +43,7 @@ class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvi
3643
* @param StoreManagerInterface $storeManager
3744
* @param array $meta
3845
* @param array $data
46+
* @param ResourceConnection|null $resourceConnection
3947
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
4048
*/
4149
public function __construct(
@@ -48,7 +56,8 @@ public function __construct(
4856
FilterBuilder $filterBuilder,
4957
StoreManagerInterface $storeManager,
5058
array $meta = [],
51-
array $data = []
59+
array $data = [],
60+
ResourceConnection $resourceConnection = null
5261
) {
5362
parent::__construct(
5463
$name,
@@ -62,6 +71,7 @@ public function __construct(
6271
$data
6372
);
6473
$this->storeManager = $storeManager;
74+
$this->resourceConnection = $resourceConnection ?: ObjectManager::getInstance()->get(ResourceConnection::class);
6575
}
6676

6777
/**
@@ -87,11 +97,38 @@ public function getData()
8797
->create()
8898
);
8999
}
100+
101+
$themeConfigData = $this->getCoreConfigData();
90102
$data = parent::getData();
91103
foreach ($data['items'] as & $item) {
92104
$item += ['default' => __('Global')];
105+
106+
$scope = ($item['store_id']) ? 'stores' : (($item['store_website_id']) ? 'websites' : 'default');
107+
$scopeId = (int) $item['store_website_id'] ?? 0;
108+
$themeId = (int) $item['theme_theme_id'] ?? 0;
109+
110+
$criteria = ['scope' => $scope, 'scope_id' => $scopeId, 'value' => $themeId];
111+
$configData = array_filter($themeConfigData, function ($themeConfig) use ($criteria) {
112+
return array_intersect_assoc($criteria, $themeConfig) === $criteria;
113+
});
114+
115+
$item += ['short_description' => !$configData ? __('Using Default Theme') : ''];
93116
}
94117

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

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"

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"ext-ctype": "*",
2323
"ext-curl": "*",
2424
"ext-dom": "*",
25+
"ext-ftp": "*",
2526
"ext-gd": "*",
2627
"ext-hash": "*",
2728
"ext-iconv": "*",

lib/internal/Magento/Framework/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"ext-bcmath": "*",
1515
"ext-curl": "*",
1616
"ext-dom": "*",
17+
"ext-ftp": "*",
1718
"ext-gd": "*",
1819
"ext-hash": "*",
1920
"ext-iconv": "*",

package.json.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"grunt-contrib-jasmine": "~4.0.0",
2121
"grunt-contrib-less": "~3.0.0",
2222
"grunt-contrib-watch": "~1.1.0",
23-
"grunt-eslint": "~25.0.0",
23+
"grunt-eslint": "~24.3.0",
2424
"grunt-exec": "~3.0.0",
2525
"grunt-replace": "~2.0.2",
2626
"grunt-styledocco": "~0.3.0",

0 commit comments

Comments
 (0)