Thanks for the reply, this is similar to what I've done so far but I think you've slightly misunderstood what I'm trying to do.
Just be clear in my child table I have 3 different palettes, I'm trying to load the palette which goes with the selection in the parent record.
In the child table:
Code:
$GLOBALS['TL_DCA']['tl_child_table']['palettes'] => array
(
'__selector__' => array('category'),
'default' => 'category,published',
'cat_a' => 'category,field_one,field_two,published', // These fields only apply to cat_a
'cat_b' => 'category,field_three,field_four,published', // These fields only apply to cat_b
)
In the parent table I have the category select field:
Code:
$GLOBALS['TL_DCA']['tl_parent_table']['fields']['category'] => array
(
'label' => &$GLOBALS['TL_LANG']['tl_parent_table']['category'],
'inputType' => 'select',
'options' => array('cat_a' => 'Category A','cat_b' => 'Category B'),
'eval' => array('mandatory'=>true, 'includeBlankOption'=>true)
),
If a record in the parent table has it's category set to 'Category A', all of it's child records should only contain fields relevant to Category A (using the palette 'cat_a').
In the child record I have a 'category' field which is disabled, this can't be changed from the child. I'm trying to use it as a selector using a load_callback. So when the child record loads 'im using the load_callback to get the parent's category and set the child's category to match. I was hoping this would update the palette of the child category, but it doesn't because the DCA has already been loaded. So the child has the correct category set, but the wrong palette to go with it. Some how I need to force Contao to switch the palette, this is where I'm stuck.
Hopefully that makes sense!
Bookmarks