diff --git a/CHANGELOG.md b/CHANGELOG.md index 02fb45e09..c96b7818c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.6.10 +## mm/dd/2019 + +1. [](#improved) + * Added **page blueprints** to `YamlLinter` CLI and Admin reports + # v1.6.9 ## 05/09/2019 diff --git a/system/src/Grav/Common/Helpers/YamlLinter.php b/system/src/Grav/Common/Helpers/YamlLinter.php index 43bde820b..b7e608d00 100644 --- a/system/src/Grav/Common/Helpers/YamlLinter.php +++ b/system/src/Grav/Common/Helpers/YamlLinter.php @@ -20,7 +20,8 @@ class YamlLinter { $errors = static::lintConfig(); $errors = $errors + static::lintPages(); - + $errors = $errors + static::lintBlueprints(); + return $errors; } @@ -34,6 +35,18 @@ class YamlLinter return static::recurseFolder('config://'); } + public static function lintBlueprints() + { + /** @var UniformResourceLocator $locator */ + $locator = Grav::instance()['locator']; + + $current_theme = Grav::instance()['config']->get('system.pages.theme'); + $theme_path = 'themes://' . $current_theme . '/blueprints'; + + $locator->addPath('blueprints', '', [$theme_path]); + return static::recurseFolder('blueprints://'); + } + public static function recurseFolder($path, $extensions = 'md|yaml') { $lint_errors = []; diff --git a/system/src/Grav/Console/Cli/YamlLinterCommand.php b/system/src/Grav/Console/Cli/YamlLinterCommand.php index 18cdb493f..894f1c02d 100644 --- a/system/src/Grav/Console/Cli/YamlLinterCommand.php +++ b/system/src/Grav/Console/Cli/YamlLinterCommand.php @@ -61,6 +61,15 @@ class YamlLinterCommand extends ConsoleCommand $this->displayErrors($errors, $io); } + $io->section('Page Blueprints'); + $errors = YamlLinter::lintBlueprints(); + + if (empty($errors)) { + $io->success('No YAML Linting issues with blueprints'); + } else { + $this->displayErrors($errors, $io); + } + } protected function displayErrors($errors, $io)