Automatically make languages live/remove user control
Use case - on a bilingual site I need to make both configured languages live by default for any item (including settings). I'd also ideally like to remove the ability for admin users to edit this at all.
I've spotted a variable called
$controlLanguagesPublication
in the form layout which seems to hide the language active controls, and am using View::share
in AppServiceProvider
to globally force this to false
. However this seems slightly brutal and I'm not sure if there might be any side effects. Also this doesn't solve selecting all languages as active by default (although I guess I could probably figure that out during save)
Could anyone possibly confirm the best way to achieve this?1 Reply
For selecting all languages as active automatically I've wound up with some logic in
prepareFieldsBeforeCreate
on all repositories.
In case this helps anyone here is the code for my solution. And if anyone knows of a better/cleaner way please comment 👍