wintercms / wn-blocks-plugin

Block based content management plugin for Winter CMS.
MIT License
21 stars 5 forks source link

Using partials in deeply folders structure #6

Closed damsfx closed 1 year ago

damsfx commented 1 year ago

Blocks plugin no longer allows to use partials in two (or more) depth levels.

📂 themes
 ┗ 📂 demo
   ┗ 📂 partials
     ┣ 📂 site
     ┃ ┣ 📂 test 
     ┃ ┃ ┗ 📜 test.htm    <=== Display this partial throw an error if Winter.blocks is enabled
     ┃ ┗ 📜 test.htm      <=== Display this partial works
     ┗ 📜 test.htm        <=== Display this partial works

With Winter.Blocks plugin enabled :
An exception has been thrown during the rendering of a template ("The partial 'site/test/test' template cannot be found.").
Running php artisan cache:clear does not solve this issue.

With Winter.Blocks plugin disabled : No errors, all works fine.

This issue appears after commit https://github.com/wintercms/wn-blocks-plugin/commit/9f084786d9af680c9b2046ad8d8828f1d627b508
My test environment :

winter/storm                 dev-develop 65920e8
winter/wn-backend-module     dev-develop 990252f
winter/wn-cms-module         dev-develop 03b80c6
winter/wn-system-module      dev-develop cf0c382
winter/wn-pages-plugin       v2.1.1
winter/wn-blocks-plugin      dev-main c7edec1
damsfx commented 1 year ago

I've seen that the issue is the result of listening to cms.theme.registerHalcyonDatasource in the plugin extendThemeDatasource method.

All files in subdirectories of themes/demo/assets/less/ are also ignored.

What I have do to get more info :

  1. Clear cache with artisan cache:clear
  2. in Halcyon\Datasource\FileDatasource
    I've set the $maxDepth property to 2 (https://github.com/wintercms/storm/blob/develop/src/Halcyon/Datasource/FileDatasource.php#L40).

This solve the issue in FrontEnd but ...

important note :

Setting $maxDepth to another value than the default one throw an exception (File does not exist at path ) in "Backend > Pages"

I think the issue is resulting of https://github.com/wintercms/storm/commit/b693175be5b9f938295e4d71eb927c8373541490 changes.

LukeTowers commented 1 year ago

@jaxwilko could you look into this for me?

damsfx commented 1 year ago

@jaxwilko Did you have time to take a look at this? I've tried to dig deeper into the issue ... but to no avail.

LukeTowers commented 1 year ago

@damsfx can you test https://github.com/wintercms/storm/commit/e22854389fead233b3f683611f85e651ffc4f246?

damsfx commented 1 year ago

@damsfx can you test wintercms/storm@e228543?

  - Upgrading winter/storm (dev-develop 9e0508c => dev-develop e228543): Extracting archive
  - Upgrading winter/wn-backend-module (dev-develop 1ab98f8 => dev-develop 851ec48): Extracting archive
  - Upgrading winter/wn-blocks-plugin (dev-main c7edec1 => dev-main 1301353): Extracting archive
  - Upgrading winter/wn-cms-module (dev-develop 237bc69 => dev-develop ff928b4): Extracting archive

Sounds good!
No more errors with three levels or more theme's partials.