7956 Posts in 1394 Topics by 945 members
|Go to End|
10 April 2012 at 6:05pm
What I'm trying to do is to traverse all the elements within this static field arrays of Dataobject and have it prepopulated in a dropdown box.
How do I accomplish this as part of an extension to UDF module's functionality.
11 April 2012 at 7:12pm
So this is a dropdown the user of the site can select a field from? You'll want to create your own subclass of EditableFormField and override the getFormField() to return your dropdown field populated with the fields. DataObject::database_fields() simply returns a map of names to types so if you want your dropdown to have keys and values of the field name you could do something like following quite easy..
$options = array();
foreach(DataObject::database_fields('Page') as $key => $type) $options[$key] = $key;
return new DropdownField(.., ..., $options);
Have a look at how the other editable form fields work, if you subclass EditableFormField and put your class in the mysite folder SS will automatically pick up the new form field type in the UDF create options.
14 April 2012 at 1:19am
With one minor difference - these fields would be used by the CMS administrator, not the web user.
If you ever program VB Access in the old days, you know how every data controls that gets bound by certain data source's record source's properties? In every VB form, you can bind the whole form to an entire table, along with its data controls to their corresponding fields?
That's what I'm trying to here in SS! I want to reproduce that similar experience here in UDF for those UDF's input fields.
I'm very curious how we can port this aspect of VBA's IDE within SS environment...?
|Go to Top|