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).

CommentFileSizeAuthor
#3 terms_of_use_empty_body_29228853_3.patch988 bytesnkoporec
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

a.dmitriiev created an issue. See original summary.

ritzz’s picture

Assigned: Unassigned » ritzz

Working on it.

nkoporec’s picture

Assigned: ritzz » Unassigned
FileSize
988 bytes

Since 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...

nkoporec’s picture

Status: Active » Needs review
useernamee’s picture

Version: 8.x-2.0-beta1 » 8.x-2.x-dev
Status: Needs review » Reviewed & tested by the community

Hi, 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.

ivnish’s picture

Thanks!

  • ivnish committed b4198c9 on 8.x-2.x authored by nkoporec
    Issue #2928853 by nkoporec, a.dmitriiev, ivnish, ritzz, useernamee:...
ivnish’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.