Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/PatternLab/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,20 @@ protected function generatePatterns($options = array()) {
// modify the pattern mark-up
$markup = $patternStoreData["code"];
$markupFull = $patternStoreData["header"].$markup.$patternStoreData["footer"];


/** If the base template for a JSON / Yaml file (or psuedo pattern variation) lives in a different folder,
* use the `original` pattern's template instead.
* Fixes https://github.com/drupal-pattern-lab/patternlab-php-core/issues/22
*/
if (!file_exists($patternSourceDir."/".$pathName.".".$patternExtension)){
$originalPatternPathName = PatternData::getOption($patternStoreData["original"])["pathName"];
if (file_exists($patternSourceDir."/".$originalPatternPathName.".".$patternExtension)){
$pathName = $originalPatternPathName;
}
}


$markupEngine = file_get_contents($patternSourceDir."/".$pathName.".".$patternExtension);

// if the pattern directory doesn't exist create it
Expand Down