I have a nicely working migxdb setup with a custom package for image galleries per resource. Each entry has image, title, description and a boolean field 'isHeader'.
isHeader indicates the image to use as, you guessed it, header image.
So far I have added a column field with renderSwitchStatusOption > switchOption. With this the user can easily select the header image right from the column without openening the entry for editing. Nice.
But with this setup there is no guarantee, that only one image is selected as header. Could be two or all, if the user just clicks on all.
Question is: is there an easy way to automatically unselect selected isHeader-fields, when a new one is selected? Like adding a custom renderer?
Thx.
@itWilllBeOK
It does run the
components/migx/processors/mgr/default/handlecolumnswitch.php
processor, right?
Then you just need to create your own
components/yourpackage/processors/mgr/default/handlecolumnswitch.php
or if you have defined a processorspath in the config you can put it there:
components/yourpackage/processors/mgr/yourprocessorspath/handlecolumnswitch.php
Then do the stuff in that processor.
So if I create the handler in one of those other locations, it will automatically override the default handler?
That would be fine in this case, I will try that.
But just for the record: if I used it like this I couldn't use the default functionality and my custom functionality in the same package, right? Because it is overridden?
Would I then do the thing with the grid.mypackagewhatever_id.config.inc.php to have a custom handler?
@itWilllBeOK
this is not a new handler, what you create here, but a processor.
And you can use different processors at the same package by defining different processor-pathes for each configuration.
If you really need custom-javascript-handlers, you can define them here:
components/yourpackage/migxconfigs/grid/grid.config.php
There should be some example-packages, which have custom-handlers on my github-repo
Ok, a processor.
I will just try if I can get somewhere with all this info. If my brains are too small to get it, I will come back and bother you some more.
As always: Thanks, Bruno.
@itWilllBeOK