New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI command to scaffold content-types #37
Comments
We could (and this is dangerous territory ;)) use the Prismic API to query the field types and generate the block definitions as well, but that would involve a large number of assumptions. |
First stab at scaffolding; https://github.com/elgentos/magento2-prismicio/tree/scaffolding There are a number of assumptions, hard-coded examples and omissions, most notably;
Ideally, we should provide another command (or a flag) that allows us to either pass the JSON from Prismic or even better, query the Prismic API to retrieve the content type configuration. It can then infer block classes ( Output;
|
Created a video to show how easy the process is; https://www.youtube.com/watch?v=ze1j91-4_OE |
@peterjaap thanks for the great work! It's working over here. But when i change the |
@JoostWan I also noticed that didn't work. Have you found a solution in the meantime? |
The scaffold command has been merged into version 1.6.0, and it is now a bit more generic; just run |
I was just checking if we can use the module for a client. Maybe i have some time later to fix this. |
We could create a CLI command that scaffolds PHTML/XML for content-types. Let's say you have a content type in Prismic called
authors
.You would then run
bin/magento prismic:scaffold --title authors--content-type authors --route authors --theme Vendor/Theme --overview
. The overview flag would be optional, to create an overview page.The title and route flag would also be optional. If these are passed we could create the route entries;
The command would then generate:
Detail page XML:
app/design/frontend/Vendor/Theme/Elgentos_PrismicIO/layout/prismicio_by_type_authors.xml
Detail template;
app/design/frontend/Vendor/Theme/Elgentos_PrismicIO/templates/authors/detail.phtml
And if the
--overview
flag was passed, also generate the overview XML/template & card template;Overview page XML:
app/design/frontend/Vendor/Theme/Elgentos_PrismicIO/layout/prismicio_route_index_authors.xml
Overview template;
app/design/frontend/Vendor/Theme/Elgentos_PrismicIO/templates/authors/overview.phtml
Card template:
app/design/frontend/Vendor/Theme/Elgentos_PrismicIO/templates/authors/card.phtml
The text was updated successfully, but these errors were encountered: