-
-
Notifications
You must be signed in to change notification settings - Fork 548
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
Dictionary tag breaks when custom option is not set #11004
Comments
Should you not just be looking for the |
Just to confirm, you're using this in the context of a form field and you're trying to pass a config option to the dictionary? I'm not sure I totally understand the issue. |
Yes @duncanmcclean, this is used in the context of a form field. The issue is arising in the frontend template when the config option is not set because the toggle is off (false), likely it's trying to access a key that is not set, Sorry for not being totally clear, hope this clarifies it a bit more. |
Why are you adding your own |
It was to be consistent with the way select field types are rendered. I am using this option to generate the appropriate template. I am not using the template rendered by default. Regardless, I think this is a bug introduced since it crashes when rendering the antler tag and the key is not present. Normally antlers would gracefully and silently handle these cases. In other words, regardless of my use case here, another custom option added to a dictionary field would likely cause the same issue if the field is not set (not tested but I could if you want) and it makes the behaviour expected from antlers inconsistent here. It should handle the exception when a key is not found like it does normally. Well in |
This comment was marked as spam.
This comment was marked as spam.
Did you miss my reply? You are calling dictionary:multiple which will be looking for a dictionary called multiple - which is where the error comes from. That isn’t the name of your variable surely? |
I see your issue. The actual config of the field has a Since you are doing something pretty custom here, I would say just tell Antlers you want the variable and not the tag. {{ $dictionary:multiple ?= " []" }} |
Bug description
The new dictionary antler tag introduced in v5.31.0 (#10885) throws a not found exception when a custom option is not set.
I have added a custom
multiple
toggle option to my dictionary. When the option is not set, the page with the form using that dictionary throws a not found exception.How to reproduce
in the dictionary definition class, add a custom field option item:
Use the dictionary tag in your form field. I use a form partial defined in
resources/views/partials/forms/fields/dictionary.antlers.html
dynamically rendered in my form template.If multiple is not define because the toggle option on the form field is set to disabled, then the exception is thrown
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
The text was updated successfully, but these errors were encountered: