DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
Dropdown¶
This might sound too regular as there are more column handler that show dropdowns, but here's the thing:
Column handler | Form element | Where do the values come from? |
---|---|---|
Enum | dropdown | inside the database table configuration (type: enum) |
Dropdown | dropdown | manually configured in SQL Frontend |
ForeignSingle | dropdown | another database table |
aOption¶
And here it is, the array where you manually configure the options presented in this dropdown. Use array keys as the values saved to the database and the corresponding array-key values are shown to the user.
'aOption' => array(
'1' => 'TYPO3',
'2' => 'Drupal',
'3' => 'Wordpress'
)
In the example above the values 1, 2 or 3 are written to the database but TYPO3, Drupal or Wordpress are presented in the dropdown to the user.
You may also group entries in order to provide dropdown group headlines (see http://www.w3schools.com/tags/tag_optgroup.asp). You do that by using the array-key as the headline and another array as the group.
'aOption' => array(
'Swedish Cars' => array(
'10' => 'Volvo',
'11' => 'Saab'
),
'German Cars' => array(
'20' => 'Mercedes',
'21' => 'Audi'
)
)
And as you already know, the database later only contains the values themselves (e.g. 10 or 21).
aMapping¶
This is a very powerful array setting that allows you to translate real database-saved values to nicely formatted outputs (not for the form, though). Now this sounds as if you don't want to do that on your own but for limited amount of options it makes sense to configure that manually.
The only thing you need to do is to configure the value you want to translate (map, thus the name) as array key and the output it should become (be mapped on) as the configuration value. Pretty easy example: Translate the cars into their logos:
'aMapping' => array(
'10' => '<img src="fileadmin/img/volvo.png" alt="Volvo" />',
'11' => '<img src="fileadmin/img/saab.png" alt="Saab" />',
'20' => '<img src="fileadmin/img/mercedes.png" alt="Mercedes" />',
'21' => '<img src="fileadmin/img/audi.png" alt="Audi" />'
)