This repository has been archived by the owner on Jun 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround to address unexpected Pattern Lab Psuedo-Pattern Data Inhe…
…ritance (#519) * Reverting Pattern Lab psuedo-pattern rules to use original merge function vs array_replace_recursive -- temporary workaround to address unexpected behavior from drupal-pattern-lab/patternlab-php-core#12 * Adding composer patch library to automatically apply array_merge patch if/when upstream PL updates should occur * Adding composer patch plugin to autoloader
- Loading branch information
Showing
16 changed files
with
2,548 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
diff --git a/src/PatternLab/PatternData/Rules/PseudoPatternRule.php b/src/PatternLab/PatternData/Rules/PseudoPatternRule.php | ||
index 8575790c..8136c3c1 100755 | ||
--- a/src/PatternLab/PatternData/Rules/PseudoPatternRule.php | ||
+++ b/src/PatternLab/PatternData/Rules/PseudoPatternRule.php | ||
@@ -167,8 +167,19 @@ class PseudoPatternRule extends \PatternLab\PatternData\Rule { | ||
|
||
} | ||
|
||
+ /** Revert array_replace_recursive function to the original array_merge behavior (added to PL Core in July of 2016 | ||
+ * https://github.com/pattern-lab/patternlab-php-core/commit/613c7b6db41610ee858b0a6b80c9e0ffc7aab08f ) | ||
+ * NOTE: this should be treated as a temporary workaround to address the differences in behavior | ||
+ * brought up in https://github.com/drupal-pattern-lab/patternlab-php-core/issues/12 until the ability | ||
+ * to officially swap out or change core PL rule behavior is added | ||
+ * | ||
+ * 1. Changed occurrences of `array_replace_recursive` back to original `array_merge` | ||
+ * | ||
+ **/ | ||
+ | ||
+ | ||
// make sure the pattern data is an array before merging the data | ||
- $patternStoreData["data"] = is_array($patternData) ? array_replace_recursive($patternDataBase, $patternData) : $patternDataBase; | ||
+ $patternStoreData["data"] = is_array($patternData) ? array_merge($patternDataBase, $patternData) : $patternDataBase; /* [1] */ | ||
|
||
// if the pattern data store already exists make sure it is merged and overwrites this data | ||
if (PatternData::checkOption($patternStoreKey)) { | ||
@@ -177,7 +188,7 @@ class PseudoPatternRule extends \PatternLab\PatternData\Rule { | ||
// don't overwrite nameClean | ||
unset($patternStoreData['nameClean']); | ||
} | ||
- $patternStoreData = array_replace_recursive($existingData, $patternStoreData); | ||
+ $patternStoreData = array_merge($existingData, $patternStoreData); /* [1] */ | ||
} | ||
PatternData::setOption($patternStoreKey, $patternStoreData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This is the top-most .editorconfig file; do not search in parent directories. | ||
root = true | ||
|
||
# All files. | ||
[*] | ||
end_of_line = LF | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor/ |
Oops, something went wrong.