Problem/Motivation
If the body field in the select node for terms of use data is empty there is an error thrown
InvalidArgumentException: $string ("") must be a string.
Also there should be a check if body field exists. Maybe it is better to allow to choose the field to be rendered with viewbuilder? or maybe selecting a viewmode for rendering the text?
Proposed resolution
Add checks for empty data before calling t() function.
Discuss on the improvement of rendering the text and not getting raw value.
Remaining tasks
Create patch.
User interface changes
Add the settings for rendering text from field (selectable) or complete node (view mode selectable).
I'm willing to help to implement the changes. I just want to ask for community opinion on how it would be more useful for the end users (please check User interface chnages and resolution sections).
Comment | File | Size | Author |
---|---|---|---|
#3 | terms_of_use_empty_body_29228853_3.patch | 988 bytes | nkoporec |
Comments
Comment #2
ritzz CreditAttribution: ritzz at Valuebound commentedWorking on it.
Comment #3
nkoporecSince no patch was posted by @ritzz in 3 months, I created a patch which fixes this error.Please reviewed it.I added a simple check for body value...
Comment #4
nkoporecComment #5
useernamee CreditAttribution: useernamee at Agiledrop - Your Trusted Drupal Teammates commentedHi, I have reproduced this error and tested patch #3 on 8.x-2.x-dev (That's why I have also changed version). It works and it is also useful if you only have one question as a term of service.
Comment #6
ivnish CreditAttribution: ivnish commentedThanks!
Comment #8
ivnish CreditAttribution: ivnish commented