Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 849bc4d

Browse files
authored
Merge pull request #363 from rasenplanscher/master
Fix data-merging for pseudo-patterns
2 parents e52ced8 + 8da8011 commit 849bc4d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: core/lib/PatternLab/Builder.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ protected function gatherPatternInfo() {
685685

686686
/*************************************
687687
* This section is for:
688-
* JSON psuedo-patterns
688+
* JSON pseudo-patterns
689689
*************************************/
690690

691691
$patternSubtypeInclude = ($patternSubtypeSet) ? $patternSubtype."-" : "";
@@ -759,7 +759,7 @@ protected function gatherPatternInfo() {
759759
}
760760

761761
// get the special pattern data
762-
$patternData = (array) json_decode(file_get_contents($object->getPathname()));
762+
$patternData = (array) json_decode(file_get_contents($object->getPathname()),true);
763763
$this->jsonLastErrorMsg($object->getFilename());
764764

765765
// merge them for the file
@@ -768,11 +768,9 @@ protected function gatherPatternInfo() {
768768
$this->d["patternSpecific"][$patternPartial]["data"] = array();
769769
$this->d["patternSpecific"][$patternPartial]["listItems"] = array();
770770
}
771-
772771
if (is_array($patternDataBase) && is_array($patternData)) {
773-
$this->d["patternSpecific"][$patternPartial]["data"] = array_merge($patternDataBase, $patternData);
772+
$this->d["patternSpecific"][$patternPartial]["data"] = array_replace_recursive($patternDataBase, $patternData);
774773
}
775-
776774
}
777775

778776
} else if ($object->isFile() && ($object->getExtension() == "json")) {

0 commit comments

Comments
 (0)