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 @@ -309,13 +309,15 @@ GeneratorTrait
309309All generator commands must use the ``GeneratorTrait `` to fully utilize its methods that are used in code
310310generation.
311311
312- *************************************
313- Accessing a Custom Generator Template
314- *************************************
312+ *************************************************************
313+ Declaring the Location of a Custom Generator Command Template
314+ *************************************************************
315315
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 ``
316+ The default order of lookup for generator templates is first, the template defined in the **app/Config/Generators.php ** file,
317+ and if not found, the template will be looked up at the ``CodeIgniter\Commands\Generators\Views `` namespace.
318+
319+ To declare the template location for your custom generator command, you will need to add it to the **app/Config/Generators.php **
318320file. 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:
321+ directory ** app/Commands/Generators/Views/awesomecommand.tpl.php ** , you would update the config file like so:
320322
321323.. literalinclude :: cli_generators/001.php
Original file line number Diff line number Diff line change @@ -8,6 +8,6 @@ class Generators extends BaseConfig
88{
99 public array $ views = [
1010 // ..
11- 'make:awesome-command ' => 'App\Commands\Generators\awesomecommand.tpl.php ' ,
11+ 'make:awesome-command ' => 'App\Commands\Generators\Views\ awesomecommand.tpl.php ' ,
1212 ];
1313}
You can’t perform that action at this time.
0 commit comments