Hi all,
Is it possible to add custom arguments to a field within a DCA that can be accessed by a custom widget?
Cheers
Hi all,
Is it possible to add custom arguments to a field within a DCA that can be accessed by a custom widget?
Cheers
Of course. That's how all the widgets do it. The DCA and therefore anything in the array is a available.
Hi pbrooks,
Hope you don't mind if continue in your thread, for what I am asking is about DCA.
Hi Thyon,
I once remember you wrote somewhere in forum, that DCA fields does not necessarily has to have a corresponding DB fields. can you please tell me where can i look for such examples? Thanks
OM MANI PEME HUNG! how many has to die for freedom and dignity. Save this world
the DCA is just a data array that is loaded when the table is edited or a module accesses the table manually. The Contao system uses the DCA to determine how to display, edit and list the data in the DB. You can however add any variable ANYWHERE in the DCA, best place would be in the eval section, although it can be anywhere as long as it doesn't conflict with a Contao pre-set.
The Catalog uses this method to add tons of additional variables to the system. In fact if you write a widget, it's really up to you to decide which extra parameters your should support/add and how your widget will read and respond to those settings. The backend_tabletree uses custom variables to display it's table tree in a very special way, which is completely different to a filetree or pagetree, to get that right, it adds extra icon, title and other settings in the DCA in the eval section and also in the fields parameters.
best place to add your custom "settings":
Code:'eval' => array('mandatory'=>true, 'tl_class'=>'w50', 'mynewparameter'=>'mynewvalue')
Bookmarks