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
fix: working fix to address PL referencing template paths to psuedo-p…
…atterns which don't exist. Addresses #22
  • Loading branch information
bolt-bot committed Oct 2, 2017
commit 81515360b9e600429afc13e8bb7a71961aacd19e
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