Skip to content

Commit

Permalink
Merge pull request #11 from JeroenVanLeusden/patch-3
Browse files Browse the repository at this point in the history
Possibility to split config path containing only two parts
  • Loading branch information
kiwi-commerce authored Jun 5, 2020
2 parents 40f9511 + 4af8fb1 commit 2652fcb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Model/Activity/SystemConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,16 @@ public function getPath($model)
public function getOldData($model)
{
$path = $this->getPath($model);
$systemData = $this->valueFactory->create()->getCollection()
->addFieldToFilter('path', ['like'=> $path.'/%']);
$systemData = $this->valueFactory->create()->getCollection()->addFieldToFilter('path', ['like'=> $path.'/%']);
$data = [];
foreach ($systemData->getData() as $config) {
list($path, $group, $field) = explode('/', $config['path']);
$splittedPath = explode('/', $config['path']);
if (count($splittedPath) === 2) {
[$group, $field] = explode('/', $config['path']);
} else {
[$path, $group, $field] = explode('/', $config['path']);
}

$data[$group]['fields'][$field]['value'] = $config['value'];
}

Expand Down

0 comments on commit 2652fcb

Please sign in to comment.