Skip to content

Commit

Permalink
Check all inherited config values to inlude them into css file.
Browse files Browse the repository at this point in the history
  • Loading branch information
vovayatsyuk committed Nov 8, 2019
1 parent 43cf116 commit 8a70b7a
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions Model/Css.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,27 @@ public function getThemeConfig($theme, $storeId, $websiteId)
$scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
$scopeCode = null;
}
$node = $this->configLoader->getConfigByPath(
$theme,
$scope,
$scopeCode
);

$node = $this->configLoader->getConfigByPath($theme, $scope, $scopeCode);
$defaultNode = [];
$websiteNode = [];

if ($storeId || $websiteId) {
$defaultNode = $this->configLoader->getConfigByPath(
$theme,
ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
null
);
}

if ($storeId) {
$websiteNode = $this->configLoader->getConfigByPath(
$theme,
ScopeInterface::SCOPE_WEBSITES,
$this->storeManager->getStore($storeId)->getWebsite()->getId()
);
}

$tab = $this->configStructure->getElement($theme);
if (!$node || !$tab) {
return [];
Expand All @@ -209,9 +225,13 @@ public function getThemeConfig($theme, $storeId, $websiteId)
// This makes config to be written in correct order into css file.
$config = [];
foreach ($this->collectPaths($tab) as $path) {
if (empty($node[$path])) {
if (empty($node[$path]) &&
empty($defaultNode[$path]) &&
empty($websiteNode[$path])
) {
continue;
}

$value = $this->helper->getScopeConfig()->getValue($path, $scope, $scopeCode);
$parts = explode('/', $path);
$valueId = $this->helper->camel2dashed(array_pop($parts));
Expand Down

0 comments on commit 8a70b7a

Please sign in to comment.