-1

I am trying to create a plugin if the user enables plugin settings then it will replace the homepage of the website with my custom designed template

1
  • Hi DotSquares! You’ve posted several questions that don’t provide much context about what you’re looking to do or what you’ve tried. Please make sure you’re asking thoughtful, specific questions to increase your odds of getting good answers and helping others that come across your posts later. If someone takes the time to post an answer that solves your problem, please consider accepting that answer as well.
    – Matt Stein
    Jan 5 at 22:28

1 Answer 1

3

I would think that you could hook into one of the template render events like:

  • craft\web\View::EVENT_BEFORE_RENDER
  • craft\web\View::EVENT_BEFORE_RENDER_TEMPLATE
  • craft\web\View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE

Alternatively, you might want to check out the source code for the KnockKnock plugin, which intercepts page loads to present a custom password screen instead of the page being requested.

https://github.com/verbb/knock-knock/blob/craft-3/src/KnockKnock.php#L67

One of those should point you in the right direction.

Not the answer you're looking for? Browse other questions tagged or ask your own question.