mirror of
https://github.com/getgrav/grav.git
synced 2025-10-26 07:56:07 +01:00
Added page blueprints to YamlLinter
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user