Skip to content

Commit

Permalink
[#72] Skip parts kit index file
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuapease committed Dec 13, 2023
1 parent f4e0b6c commit 7852fc9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/services/PartsKit.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,32 @@ public static function getNav(): array
$partsPath = $templatesPath . '/' . $partsKitFolderName . '/';

// Combine and sort all files & directories in the parts kit
$directories = \yii\helpers\FileHelper::findDirectories($partsPath);
$directories = FileHelper::findDirectories($partsPath);
$files = FileHelper::findFiles($partsPath);

$templates = [
...$directories,
...$files
];

sort($templates);
$skipPaths = [
$partsPath . 'index.twig',
$partsPath . 'index.html',
];

sort($templates);

/** @var NavNode[] $result */
$result = [];
// Loop through all the paths in the folder.
// Creating a NavNode object and putting the path to each node in the map.
foreach ($templates as $templatePath) {

// Skip ignored paths
if (in_array($templatePath, $skipPaths)) {
continue;
}

$path = str_replace($partsPath, '', $templatePath);
$pathParts = explode('/', $path);
$title = self::_formatTitle(end($pathParts));
Expand Down

0 comments on commit 7852fc9

Please sign in to comment.