Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 7251925

Browse files
committed
adding pathname and path dash props to pattern type
1 parent 2ce6e3e commit 7251925

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

core/lib/PatternLab/PatternData/Rules/PatternTypeRule.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ public function __construct($options) {
3131

3232
public function run($depth, $ext, $path, $pathName, $name) {
3333

34+
// load default vars
35+
$dirSep = PatternData::$dirSep;
36+
3437
// set-up the names
35-
$patternType = $name; // 00-atoms
36-
$patternTypeDash = $this->getPatternName($name,false); // atoms
37-
$patternTypeClean = str_replace("-"," ",$patternTypeDash); // atoms (dashes replaced with spaces)
38+
$patternType = $name; // 00-atoms
39+
$patternTypeDash = $this->getPatternName($name,false); // atoms
40+
$patternTypeClean = str_replace("-"," ",$patternTypeDash); // atoms (dashes replaced with spaces)
41+
42+
$patternTypePath = $pathName; // 00-atoms/02-blocks
43+
$patternTypePathDash = str_replace($dirSep,"-",$patternTypePath); // 00-atoms-02-blocks (file path)
3844

3945
// create a key for the data store
40-
$patternStoreKey = $patternTypeDash."-pltype";
46+
$patternStoreKey = $patternTypeDash."-pltype";
4147

4248
// add a new patternType to the nav
4349
PatternData::$store[$patternStoreKey] = array("category" => "patternType",
@@ -47,8 +53,9 @@ public function run($depth, $ext, $path, $pathName, $name) {
4753
"depth" => $depth,
4854
"ext" => $ext,
4955
"path" => $path,
50-
"pathName" => $pathName,
51-
"isDir" => $this->isDirProp ,
56+
"pathName" => $patternTypePath,
57+
"pathDash" => $patternTypePathDash,
58+
"isDir" => $this->isDirProp,
5259
"isFile" => $this->isFileProp);
5360

5461
// starting a new set of pattern types. it might not have any pattern subtypes

0 commit comments

Comments
 (0)