contao/test — Issue #429: Extending tl_module to include a new selector field makes the field visible for all module types
Author: importer
Created: 2011-11-29 06:13:03+00:00
State: open
Labels: backend, Defect

Hi Leo,

I tried to create a new selector that was a radio group just like the "source" field, but is called "category_source" with our own set of five options. It works the same as the source field in that it is used as a selector field, and you get an additional field for certain options (a page tree). However, it only applies to a specific module and of course the options that it uses are palettes just like the values "default" "internal" and "external". Our values are different but you get the idea. The problem I have is it seems that because it is designated as a selector, it comes up for all modules (such as Navigation), etc. I tried to work around it by checking the POST on the type field, but then I lose the page tree associated with certain options (the page tree won't load on submitOnChange) - in the radio group when it looks only at that specific module type.

I'm not sure if this is a bug or not, please advise. I always thought that a selector would only appear if it was listed as a field in the main palette and in selector as well. Perhaps I am doing something wrong.

here is an example of what I'm doing. Please note I am treating "radio_option_palette_1" as the example which represents the module's type key. There is no "default" of course since tl_module is already using that for another purpose. I have omitted the proper syntax to avoid the wiki auto-link functionality from breaking the general form of it...

```
$GLOBALS[TL_DCA][tl_module][palettes][+selector+][] = 'category_source';
$GLOBALS[TL_DCA][tl_module][palettes][radio_option_palette_1] = 'name;type;headline;category_source'; (etc. etc.)
$GLOBALS[TL_DCA][tl_module][palettes][radio_option_palette_2] = 'name;type;headline.... etc.
```

Thanks!

--- _Originally created by fbliss on January 20th, 2009, at 09:16am (ID 429)_