I’m using structure fields in a blueprint which works fine using <?php foreach($page->x()->toStructure() as $y): ?>
However I’m stuck when it comes to using modules. The template has a query option to select from a list of pre-created modules. The modules is constructed using Structured fields.
The template content shows only:
module: default-option
The module live in
module folder > module type > module name (as sub pages)
Not sure on the PHP needed to call the selected module, then call the relevant fields…
Any help much appreciated as I’m a proper newb…
module-a and module-b would have a different Snippets
example-1 & example-2 would share the same Snippet
So in the Content-page content file I would have
module-a: example-1
so would I add to the Content-Page.php the following?
I don’t know, I think the field in the content file should always be called the same, no matter if the user selects an module of type a or type b, otherwise you would not know what field to call (or you would have to use as many if statements as you have module types). But I guess the examples use different blueprints/have different file names? So if the user just selected a module, you could have in your content file: