0

When developing Craft 3 plugins/modules, we usually tie into the View::EVENT_REGISTER_CP_TEMPLATE_ROOTS or View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS RegisterTemplateRootsEvent events to register custom template paths for regular web requests. These events do not fire when a console command is called. Most of the time, this makes sense as templates are not typically rendered in the console.

In our case, we have a command that is run on a schedule and it is responsible for sending emails to various users. We strongly prefer to use templates for these email bodies.

Is there a way to register a module/plugin template path during a console request?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.