bonniss26
bonniss26

Hi guys, followed the docs, I have created a setting page for my theme. Now I have a demand for a customized markup snippet in which partials suit best, I think. Therefore I created themes/acme/partials/_my_snippet.htm with the content:

<?= $this->makePartial('my_snippet') ?>
<h1>My Snippet</h1>

In theme.yaml

  color_legend:
    type: partial
    path: partials\backend\my_snippet

I refreshed the theme setting page and the error '_my_snippet.htm' not found occured. I have tried several path pattern but nothing worked. Is it possible to use partials without controllers for customized markup in theme setting page? Thanks.

Last updated

mjauvin
mjauvin

your partial should not call makePartial()... just the html markup for what you want to show.

The field definition file with the type:partial IS going to call the partial creation method.

bonniss26
bonniss26

I removed the makePartial() and modify the theme.yaml to:

  color_legend:
    type: partial
    path: ~\themes\acme\partials\_my_snippet.htm

and it works. As the docs said, ~ refers to the application path. Thank you for supporting, @mjauvin.

mjauvin
mjauvin

Glad to hear you could make it work.

I agree there should be a way for the partial's path to be relative to the theme's folder.

1-4 of 4