Skip to content

Commit 2f62595

Browse files
committed
making breadcrumb an array
1 parent 210a337 commit 2f62595

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

src/PatternLab/PatternData/Rules/PatternRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function run($depth, $ext, $path, $pathName, $name) {
7777
"nameClean" => $patternClean,
7878
"type" => $patternType,
7979
"typeDash" => $patternTypeDash,
80-
"breadcrumb" => $patternTypeClean,
80+
"breadcrumb" => array("patternType" => $patternTypeClean),
8181
"state" => $patternState,
8282
"hidden" => $hidden,
8383
"noviewall" => $noviewall,
@@ -97,7 +97,7 @@ public function run($depth, $ext, $path, $pathName, $name) {
9797
if ($depth > 1) {
9898
$patternStoreData["subtype"] = $patternSubtype;
9999
$patternStoreData["subtypeDash"] = $patternSubtypeDash;
100-
$patternStoreData["breadcrumb"] = $patternTypeClean." > ".$patternSubtypeClean;
100+
$patternStoreData["breadcrumb"] = array("patternType" => $patternTypeClean, "patternSubtype" => $patternSubtypeClean);
101101
}
102102

103103
// if the pattern data store already exists make sure it is merged and overwrites this data

src/PatternLab/PatternData/Rules/PatternSubtypeRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function run($depth, $ext, $path, $pathName, $name) {
4545
$patternSubtypePath = $pathName; // 00-atoms/02-blocks
4646
$patternSubtypePathDash = str_replace($dirSep,"-",$patternSubtypePath); // 00-atoms-02-blocks (file path)
4747

48-
$patternPartial = "viewall-".$patternTypeDash."-".$patternSubtypeDash;
48+
$patternPartial = "viewall-".$patternTypeDash."-".$patternSubtypeDash;
4949

5050
// create a key for the data store
5151
$patternStoreKey = $patternTypeDash."-".$patternSubtypeDash."-plsubtype";
@@ -58,7 +58,7 @@ public function run($depth, $ext, $path, $pathName, $name) {
5858
"partial" => $patternPartial,
5959
"type" => $patternType,
6060
"typeDash" => $patternTypeDash,
61-
"breadcrumb" => $patternTypeClean,
61+
"breadcrumb" => array("patternType" => $patternTypeClean),
6262
"depth" => $depth,
6363
"ext" => $ext,
6464
"path" => $path,

src/PatternLab/PatternData/Rules/PseudoPatternRule.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ public function __construct($options) {
3737
public function run($depth, $ext, $path, $pathName, $name) {
3838

3939
// load default vars
40-
$patternSubtype = PatternData::getPatternSubtype();
41-
$patternSubtypeDash = PatternData::getPatternSubtypeDash();
42-
$patternType = PatternData::getPatternType();
43-
$patternTypeDash = PatternData::getPatternTypeDash();
44-
$dirSep = PatternData::getDirSep();
45-
$frontMeta = PatternData::getFrontMeta();
40+
$patternSubtype = PatternData::getPatternSubtype();
41+
$patternSubtypeClean = PatternData::getPatternSubtypeClean();
42+
$patternSubtypeDash = PatternData::getPatternSubtypeDash();
43+
$patternType = PatternData::getPatternType();
44+
$patternTypeClean = PatternData::getPatternTypeClean();
45+
$patternTypeDash = PatternData::getPatternTypeDash();
46+
$dirSep = PatternData::getDirSep();
47+
$frontMeta = PatternData::getFrontMeta();
4648

4749
// should this pattern get rendered?
4850
$hidden = ($name[0] == "_");
@@ -95,7 +97,7 @@ public function run($depth, $ext, $path, $pathName, $name) {
9597
"nameClean" => $patternClean,
9698
"type" => $patternType,
9799
"typeDash" => $patternTypeDash,
98-
"breadcrumb" => $patternType,
100+
"breadcrumb" => array("patternType" => $patternTypeClean),
99101
"state" => $patternState,
100102
"hidden" => $hidden,
101103
"noviewall" => $noviewall,
@@ -115,12 +117,12 @@ public function run($depth, $ext, $path, $pathName, $name) {
115117
if ($depth > 1) {
116118
$patternStoreData["subtype"] = $patternSubtype;
117119
$patternStoreData["subtypeDash"] = $patternSubtypeDash;
118-
$patternStoreData["breadcrumb"] = $patternType." > ".$patternSubtype;
120+
$patternStoreData["breadcrumb"] = array("patternType" => $patternTypeClean, "patternSubtype" => $patternSubtypeClean);
119121
}
120122

121123
$patternDataBase = array();
122-
if (file_exists(Config::getOption("patternSourceDir")."/".$path."/".$patternBaseData)) {
123-
$data = file_get_contents(Config::getOption("patternSourceDir")."/".$path."/".$patternBaseData);
124+
if (file_exists(Config::getOption("patternSourceDir").DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$patternBaseData)) {
125+
$data = file_get_contents(Config::getOption("patternSourceDir").DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$patternBaseData);
124126
if ($ext == "json") {
125127
$patternDataBase = json_decode($data,true);
126128
if ($jsonErrorMessage = JSON::hasError()) {
@@ -144,7 +146,7 @@ public function run($depth, $ext, $path, $pathName, $name) {
144146
}
145147

146148
// get the data for the pseudo-pattern
147-
$data = file_get_contents(Config::getOption("patternSourceDir")."/".$pathName);
149+
$data = file_get_contents(Config::getOption("patternSourceDir").DIRECTORY_SEPARATOR.$pathName);
148150
if ($ext == "json") {
149151
$patternData = json_decode($data,true);
150152
if ($jsonErrorMessage = JSON::hasError()) {

0 commit comments

Comments
 (0)