Type of CE inside onload_callback function?
Contao < 2.11
Is there a way to find out which content element(CE) (['TL_CTE']) is selected in (Backend)BE, inside onload_callback function?
Basically I want to change the DCA dynamically depending on the type of CE chosen in BE. I have custom module (which uses tl_content) in which, I use the field 'text' from default CE. I wanted that text field in my custom CE not as mandatory. do anyone have suggestion, please let me know.
Re: Type of CE inside onload_callback function?
Another method then using the id to query the database?
Re: Type of CE inside onload_callback function?
Thank you for the tip.
I did as you have suggested. Which worked too. But the problem remains because I am using the default text field from CE. The text field get submitted automatically when ever you change the CE type from text to any other, this produce error when you are using the same text field, as it is defined mandatory by default. After force saving the CE, mandatory mark goes away, but it creates confusion!
The solution in my case is to change the eval mandatory of text field to false in all case!! or I may define a new text field in DB.
Re: Type of CE inside onload_callback function?
The solution you used was my first idea, but since you specifically asked for a solution where you switch this off ONLY for your type I opted for querying.