Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings fail to save when only one language is available #50

Closed
manuelsofia opened this issue Oct 25, 2018 · 4 comments
Closed

Settings fail to save when only one language is available #50

manuelsofia opened this issue Oct 25, 2018 · 4 comments
Labels
status: working on it Someone is already working on this issue type: bug Something isn't working type: enhancement New feature or request

Comments

@manuelsofia
Copy link

manuelsofia commented Oct 25, 2018

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!

@manuelsofia manuelsofia changed the title Relationship setup between model and media Settings fail to save when only one language is available Oct 28, 2018
@ifox
Copy link
Member

ifox commented Oct 29, 2018

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!

@manuelsofia
Copy link
Author

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

@ifox ifox added type: bug Something isn't working type: enhancement New feature or request labels Oct 30, 2018
@ifox ifox added the status: working on it Someone is already working on this issue label Nov 9, 2018
@yanhao-li
Copy link

come across the same issue here.

@ifox
Copy link
Member

ifox commented Dec 12, 2018

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

See #91 (comment) for more info.

@ifox ifox closed this as completed Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: working on it Someone is already working on this issue type: bug Something isn't working type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants