diff --git a/user_guide_src/source/cli/cli_generators.rst b/user_guide_src/source/cli/cli_generators.rst index 5a22c8b65cbc..d66255bd1f18 100644 --- a/user_guide_src/source/cli/cli_generators.rst +++ b/user_guide_src/source/cli/cli_generators.rst @@ -308,3 +308,16 @@ GeneratorTrait All generator commands must use the ``GeneratorTrait`` to fully utilize its methods that are used in code generation. + +************************************************************* +Declaring the Location of a Custom Generator Command Template +************************************************************* + +The default order of lookup for generator templates is (1) the template defined in the **app/Config/Generators.php** file, +and (2) if not found, the template found at the ``CodeIgniter\Commands\Generators\Views`` namespace. + +To declare the template location for your custom generator command, you will need to add it to the **app/Config/Generators.php** +file. For example, if you have a command ``make:awesome-command`` and your generator template is located within your *app* +directory **app/Commands/Generators/Views/awesomecommand.tpl.php**, you would update the config file like so: + +.. literalinclude:: cli_generators/001.php diff --git a/user_guide_src/source/cli/cli_generators/001.php b/user_guide_src/source/cli/cli_generators/001.php new file mode 100644 index 000000000000..26356cf34741 --- /dev/null +++ b/user_guide_src/source/cli/cli_generators/001.php @@ -0,0 +1,13 @@ + 'App\Commands\Generators\Views\awesomecommand.tpl.php', + ]; +}