I’ve been playing with modX and searching for a workflow that i find nice to work with.
I also like using my IDE instead of the manager so i took a look at static elements
and those work great when created in the manager.
Even better would be creating elements automaticaly from the file system. So i dont need the manager
at all if i quickly want to make another chunk/snippet.
I’ve found ElementHelper for that but couldn’t get it to work perfectly ( maybe it’s too old).
So i took a look at the ElementHelper and kinda made my own plugin that adds templates/snippets/plugins and chunks to modX if they exist in the filesystem but not in the database.
( Plugin runs on OnManagerPageInit and OnWebPageInit )
Everything works fine and the (ie) chunk is created, made static with correct path etc.
But the content doesnt show up initially. I still have to go to the created chunk in the manager, and hit the save button for it to show up and have a proper working static element.
For setting the content i use
$element->save(); element being
$element = $this->modx->newObject('modChunk'); But i guess that is not working…
Could someone tell me if i am missing something?
TLDR: Programatically added static elements don’t ‘sync’ content till i hit save in the manager.
edit: Nice site overhaul btw