Skip to content
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

Type error when attempting to use repeat modifier #3259

Closed
danwatts-dev opened this issue Feb 17, 2021 · 0 comments · Fixed by #3261
Closed

Type error when attempting to use repeat modifier #3259

danwatts-dev opened this issue Feb 17, 2021 · 0 comments · Fixed by #3261
Labels

Comments

@danwatts-dev
Copy link

Bug Description

When using the repeat modifier with an integer variable as its argument I get the following type error:
"TypeError str_repeat(): Argument #2 ($times) must be of type int, Statamic\Fields\Value given"

How to Reproduce

Define an integer variable (e.g. {{ rating }}) in an entry.
Try and use it in the repeat modifer as follows:

---
thing: //html to be repeated here //
---
{{ view:thing | repeat:rating }}

Screenshots:
Template:
Screenshot 2021-02-17 at 09 43 27

Blueprint with int field shown:
Screenshot 2021-02-17 at 09 47 05

Error msg:
Screenshot 2021-02-17 at 09 43 55

Environment:
Statamic 3.0.43 Solo
Laravel 8.27.0
PHP 8.0.2
statamic/ssg dev-master

Install method:

  • Fresh install from statamic/statamic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants