Twill: Settings fail to save when only one language is available

Created on 26 Oct 2018  Â·  4Comments  Â·  Source: area17/twill

Hello, thanks for such an amazing admin package, I absolutely love Twill!

I'm having the following issue: I'm building a CMS for a single language website (english). I enabled the Settings option in the config/twill.php file, I copied the settings migration to my migrations folder as suggested in the documentation but removed the translations table as I will not use it. My "translatable" locales settings array only contains the "en" code so no other languages are available. The problem comes when I try to store some settings as I get the following error:

ErrorException (E_WARNING) Illegal string offset 'en' 66 ErrorException …/vendor/area17/twill/src/Repositories/SettingRepository.php45

I've tried adding the "translated=false" attribute on the form fields but I still get the same error.

I removed the tables and re-executed the migrations but this time leaving the translations table, I enabled the translated=true attribute on the form fields and it worked correctly, however I can't store any images so it does not solve my problem.

Any help would be much appreciated.

Thank you!

working on it bug enhancement

All 4 comments

Hi @manuelsofia,

thanks for your kind words :) And happy to see that you've been able to sort out many of your issues on your own. Your feedback is super helpful to improve our docs!

2 things about the settings feature:

  • it does require keeping the translations table, simply because the value is saved there, even if you have a single language. I definitely feel like it shouldn't be in that case, we can think about improving!
  • for now, only text inputs work in settings forms. This is quite a limitation and could be a very useful change to support more fields there. For now, I'd suggest creating a module, even if it's for a single record.

Cheers!

Hi @ifox , thank you very much for your reply, I really appreciate it.

come across the same issue here.

Fixed. This will be released in 1.2.1 and can be tested using 1.2.x-dev.

See https://github.com/area17/twill/pull/91#issuecomment-446488514 for more info.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stevanpavlovic picture stevanpavlovic  Â·  7Comments

madsem picture madsem  Â·  4Comments

lostdesign picture lostdesign  Â·  5Comments

layout-lab picture layout-lab  Â·  5Comments

dafyd picture dafyd  Â·  3Comments