cms icon indicating copy to clipboard operation
cms copied to clipboard

`read_time` with Bard sets throws string conversion error

Open mynetx opened this issue 3 years ago • 2 comments

The read_time modifier cannot traverse into sets within Bard fields. Instead, an Array to string conversion error is shown.

Statamic 3.2.9 Pro Laravel 8.62.0 PHP 8.0.9 jonassiewertsen/statamic-documentation 1.5.0 webographen/statamic-dynamic-token 1.0.0 withcandour/aardvark-seo 2.0.16

Discussed in https://github.com/statamic/cms/discussions/4341

Originally posted by austriker27 September 30, 2021 Hello!

Has anyone gotten the read_time modifier working with bard when you have sets?

I found this post for awhile ago but its not working for me (post is from V2): https://statamic.com/forum/2970-read-time-from-bard-fieldtype

When I try this in antlers:

{{ blog_content | flatten | join | strip_tags | read_time:180 }} min read

I get this error: Error: Array to string conversion

Inside the CMS, at the bottom of the bard field it does show the read time when Im using sets. Not sure if this is helpful but I looked at the source code and its using this package: https://www.npmjs.com/package/read-time-estimate

mynetx avatar Sep 30 '21 14:09 mynetx

I also have this problem.

lukeagsmith avatar Aug 09 '22 16:08 lukeagsmith

Should be resolved by #6226

jasonvarga avatar Aug 09 '22 18:08 jasonvarga