contao/test — Issue #2888: Bug in Controller/PrepareForWidget or GROUP headings
Author: importer
Created: 2011-11-29 10:30:19+00:00
State: open
Labels: Defect, framework

I have a select field that has a custom options_callback. This doesn't help to set the labels for the SORT/GROUP, as the labels get discarded, so the group headings appear as 45, 243, 642, etc.,

To fix this, I add the foreignKey => 'tl_taxonomy.name' to allow contao to automatically use the tile to lookup the labels (as they are discarded in DC_Table.php).

However when I add this, it appears that the foreignKey will then override the options_callback (which it shouldn't), so to fix this, you can amend the following

Bug in prepareForWidget() in class Controller.php

```php
// Foreign key
if (strlen($arrData['foreignKey']))
```

by modifying the **if** to **elseif**:

```php
// Foreign key
elseif (strlen($arrData['foreignKey']))
```

Related issues: #3076

--- _Originally created by thyon on February 24th, 2011, at 11:56am (ID 2888)_