defaultValue parameter for preparePlainTextValue

I added this parameter in order to make preparePlainTextValue handle
null (empty) value too, since it is already responsible for truncating the value
if too big. The default value is null, so it will maintain
its original behavior and permits fallback when the plain text value
is empty.

This is a follow up of #2905