Commit 45af90ee authored by kay899's avatar kay899 Committed by Nicolas Widart

Add custom stubs folder (#344)

* Custom Stubs Folder

* Config for Custom Stubs Folder

* PSR 2 Corrections
parent c0ca29b0
<?php <?php
return [ return [
/*
|--------------------------------------------------------------------------
| Custom Stubs Folder
|--------------------------------------------------------------------------
| You can specify place from which you would like to use stubs.
| e.g. "Modules/<module-name>/Resources/views/stubs"
| Only the customized stubs need to be in this folder.
| All other stubs will be loaded from Workshop Module folder.
| No custom stubs folder: null
*/
'custom-stubs-folder' => null,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Custom Sidebar Class | Custom Sidebar Class
......
...@@ -83,6 +83,15 @@ abstract class Generator ...@@ -83,6 +83,15 @@ abstract class Generator
*/ */
protected function getStubPath($filename) protected function getStubPath($filename)
{ {
$folder = $this->config->get('asgard.workshop.config.custom-stubs-folder');
if ($folder !== null) {
$file = base_path($folder . "/" . $filename);
if ($this->finder->exists($file)) {
return $file;
}
}
return __DIR__ . "/../stubs/$filename"; return __DIR__ . "/../stubs/$filename";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment