Hi Guys…
just wondering If I’m on the right path…
Well, I just read nearly all entries here related to ACF, controllers etc. but maybe I misunderstand something.
What I wanted to achieve is, having ACF Modules based on flexible layout feature, each layout with its own Module/ Controller. Nothing new. Done that years ago iterating over the values including different templates through wp template system (custom structure & no Sage)
With Sage, these modules could be on any page, so I startet with App.php.
But with Sage9 & Blade I wanted to stay in the given structure with controllers.
First, I’m only able to define controllers within the controllers folder app/Controllers. If I define one in a subfolder e. g. app/Controllers/Comps/ComponentOne.php I get an error, class not found, as class ComponentOne extends Controller (Sober\Controller\Controller) which searches only within folder app/Controller and not in e. g. /Comps, am I right?
=> possible to change that? Add some additional search folders?
I then came up with traits, defined a Component trait which uses single module traits through use. But I am currently struggling as based on traits everything is added to App class and I am not sure if all modules have unique vars & methods, to not be repetitive in code… And at the end all is located within App class.
I could do a component class, get all fields, load the corresponding partials and display vars but that would not be the controller way.
Anyone got this to work, iterate over the act layouts and use one separate controller for each layout which holds its own functionality and logic?
I appreciate any tips and tricks
Thanks in advance
Michael