Skip to content

Commit 6327a11

Browse files
committed
making sure listItems works
1 parent 8305902 commit 6327a11

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/PatternLab/Data.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class Data {
2424

2525
protected static $store = array();
26-
protected static $reservedKeys = array("listItems","cacheBuster","link","patternSpecific","patternLabHead","patternLabFoot");
26+
protected static $reservedKeys = array("cacheBuster","link","patternSpecific","patternLabHead","patternLabFoot");
2727

2828
/**
2929
* Clear all of the data in the $store
@@ -76,7 +76,7 @@ public static function gather($options = array()) {
7676
$data = array();
7777
$fileName = $file->getFilename();
7878
$hidden = ($fileName[0] == "_");
79-
$isListItems = strpos("listitems",$fileName);
79+
$isListItems = strpos($fileName,"listitems");
8080
$pathName = $file->getPathname();
8181
$pathNameClean = str_replace($sourceDir."/","",$pathName);
8282

@@ -113,7 +113,7 @@ public static function gather($options = array()) {
113113

114114
} else if ($isListItems !== false) {
115115

116-
$data = ($ext == "json") ? self::getListItems("data/listitems.json") : self::getListItems("data/listitems.yaml","yaml");
116+
$data = ($ext == "json") ? self::getListItems("_data/".$fileName) : self::getListItems("_data/".$fileName,"yaml");
117117

118118
if (!isset(self::$store["listItems"])) {
119119
self::$store["listItems"] = array();
@@ -159,7 +159,7 @@ public static function get() {
159159
*
160160
* @return {Array} the final set of list items
161161
*/
162-
protected static function getListItems($filepath,$ext = "json") {
162+
public static function getListItems($filepath,$ext = "json") {
163163

164164
// set-up the dispatcher
165165
$dispatcherInstance = Dispatcher::getInstance();

src/PatternLab/PatternData/Rules/PatternInfoListItemsRule.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ public function run($depth, $ext, $path, $pathName, $name) {
5151

5252
$patternStoreData = array("category" => "pattern");
5353

54-
$data = Data::getListItems($pathName,$ext);
54+
$data = Data::getListItems("_patterns/".$pathName,$ext);
5555
$patternStoreData["listItems"] = $data;
5656

57+
// create a key for the data store
58+
$patternStoreKey = $patternPartial;
59+
60+
// if the pattern data store already exists make sure it is merged and overwrites this data
61+
$patternStoreData = (PatternData::checkOption($patternStoreKey)) ? array_replace_recursive(PatternData::getOption($patternStoreKey),$patternStoreData) : $patternStoreData;
62+
PatternData::setOption($patternStoreKey, $patternStoreData);
63+
5764
}
5865

59-
// create a key for the data store
60-
$patternStoreKey = $patternPartial;
61-
62-
// if the pattern data store already exists make sure it is merged and overwrites this data
63-
$patternStoreData = (PatternData::checkOption($patternStoreKey)) ? array_replace_recursive(PatternData::getOption($patternStoreKey),$patternStoreData) : $patternStoreData;
64-
PatternData::setOption($patternStoreKey, $patternStoreData);
65-
6666
}
6767

6868
}

src/PatternLab/PatternData/Rules/PatternInfoRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($options) {
3030
$this->isDirProp = false;
3131
$this->isFileProp = true;
3232
$this->searchProp = "";
33-
$this->ignoreProp = "~";
33+
$this->ignoreProp = "~||listitems";
3434

3535
}
3636

0 commit comments

Comments
 (0)