File tree Expand file tree Collapse file tree
user_guide_src/source/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -308,3 +308,14 @@ GeneratorTrait
308308
309309All generator commands must use the ``GeneratorTrait `` to fully utilize its methods that are used in code
310310generation.
311+
312+ *************************************
313+ Accessing a Custom Generator Template
314+ *************************************
315+
316+ By default, all generator templates will be looked up at the ``CodeIgniter\Commands\Generators\Views `` namespace.
317+ To declare a custom location for your custom generator template, you will need to add it to the ``app/Config/Generators.php ``
318+ file. For example, if you have a command ``make:awesome-command `` and your generator template is located within your *app *
319+ directory ``app/Commands/Generators/Views/awesomecommand.tpl.php ``, you would update the config file like so:
320+
321+ .. literalinclude :: cli_generators/001.php
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Config ;
4+
5+ use CodeIgniter \Config \BaseConfig ;
6+
7+ class Generators extends BaseConfig
8+ {
9+ public array $ views = [
10+ // ..
11+ 'make:awesome-command ' => 'App\Commands\Generators\awesomecommand.tpl.php ' ,
12+ ];
13+ }
You can’t perform that action at this time.
0 commit comments