[Twill2] Do settings section support media and how?

As title says, is it possible to inject media here or should I make a custom settings singleton to handle this use case?
17 Replies
ifox
ifoxβ€’2y ago
They do! They need crop config set in twill.settings.crops, that's it
kallefrombosnia
kallefrombosniaOPβ€’2y ago
Ok thank you for the fast reply! Ill try it now. πŸ™‚
kallefrombosnia
kallefrombosniaOPβ€’2y ago
No description
kallefrombosnia
kallefrombosniaOPβ€’2y ago
Any idea what can cause this? Yes im using translated media fields in the settings section
ifox
ifoxβ€’2y ago
hmm check the form submission payload
kallefrombosnia
kallefrombosniaOPβ€’2y ago
No description
kallefrombosnia
kallefrombosniaOPβ€’2y ago
If I dump media payload I get this
kallefrombosnia
kallefrombosniaOPβ€’2y ago
No description
kallefrombosnia
kallefrombosniaOPβ€’2y ago
But it tries to access it like
$settingsFields['medias'][$role][$locale]
$settingsFields['medias'][$role][$locale]
Locale which I get is sl not sl_{number} Okay I got to the root cause of the problem
kallefrombosnia
kallefrombosniaOPβ€’2y ago
Basicly If max on media is 1, this all works as expected since we get payload like this.
No description
kallefrombosnia
kallefrombosniaOPβ€’2y ago
But if there is more than 1 media in the payload, save fails since we get payload like second pic above (which should be iterated? ) @ifox.dev So should I stick with the new singleton module in the end? πŸ˜„
ifox
ifoxβ€’2y ago
ha good catch ok yeah settings in twill 2 are not supporting all use cases, hence the new block powered settings in twill 3. I'd go with a singleton to make sure you can use all fields and options.
kallefrombosnia
kallefrombosniaOPβ€’2y ago
Ok thank you for info. Ill stick with the module approach. πŸ™‚ Should I report this via issue or its not worth it? Since active support is going towards 3.x
ifox
ifoxβ€’2y ago
yeah we'll only focus on critical bug fixes and security issues on Twill 2, so probably no new "features". so I'd consider twill 2 settings as only supporting single medias fields.
kallefrombosnia
kallefrombosniaOPβ€’2y ago
Just checked, same code is in the 3.x branch, so it might occur in the future
ifox
ifoxβ€’2y ago
I'm pretty sure this is basically dead code in twill 3 with the new blocks approach, will need to be cleaned up
kallefrombosnia
kallefrombosniaOPβ€’2y ago
Cool, thank you. πŸ˜„
Want results from more Discord servers?
Add your server