So i've read through all of the developer workflow threads on the forum and it looks like there are 3 ways to work on templates, snippets, and chunks in an IDE.
1. Use an include snippet to pull in an external file
2. Use Fem or Mirror snippets to auto-sync between files and elements
3. Use new static elements in 2.2.7
Since the first 2 methods seem a bit hackish i went for the 3rd and it has potential but the workflow is not smooth. When selecting an element to be static the UI shows a media source selector and a text field for path relative to the Media Source root. Therein lies the problem, currently a Filesystem type media source defaults to the web root and there's no way to change that. So for every new element tha path has to be spelled out from the web root. If the assets folder does have some depth to it (assets/template1/articles/chunks) then the whole patch will need to be typed out for every new chunk, which is not optimal.
So my idea is to allow Filesystem Media Sources to be defined with a root path set to any folder under webroot. This way i could create a "Template 1 Chunks" media source with assets/template1/chunks root path for example. Then when creating a new chunk all i need to do is select the appropriate media source and the new chunk file will be created in the right place. Specifying a default file extension for an element would help as well. So for chunks i use .chk file extension and it would be great if it was automatically added to the chunk name to create a chunk file.
Now it's entirely possible that i'm missing the whole point of Media Sources. If that's the case please feel free to set me straight.
Otherwise, a small effort like this expended on making MODx fit into a standard development workflow would be well worth it.
Easiest way from a developer point of view is to use Elementhelper. That creates snippets/chunks/templates/categories once you save them in your texteditor. You wont need the manager at all.
Another approach would be to use Bobs My Component and preset all snippets/chunks etc.
--------------------------------------
www.williamastrom.se
Easiest way from a developer point of view is to use Elementhelper. That creates snippets/chunks/templates/categories once you save them in your texteditor. You wont need the manager at all.
Another approach would be to use Bobs My Component and preset all snippets/chunks etc.
--------------------------------------
www.williamastrom.se
Thanks for the pointers. I'll check it out.
But going forward i do want to make sure that the mechanism to link elements with their files is based on the 'static' feature rather than an include snippet. I believe the former is the proper way of doing this going forward, while the latter is heading for deprecation.
Im not sure im right here, but what if you created another user and set its ACL to your mediasource?
--------------------------------------
www.williamastrom.se
Just installed ElementHelper and it's exactly what i was after. It's using the new static feature to link the files with the elements. So after setting up folders for templates, chunks, and snippets in the settings all you need to do is just create a file in your IDE and upon modx manager refresh the new element with the same name is created. It even allows to create tvs in a separate .json file so even tvs can be put under source control. Brilliant. Thanks for the suggestion.
I'm not sure what ACL is. Could you say more?
ACL=ACCESS CONTROL LIST (
http://rtfm.modx.com/display/revolution20/ACLs ).
You can control access by users, usergroups and such.
--------------------------------------
www.williamastrom.se