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
Ability to loop through containers containing primitives in Silverstripe templates #11196
Comments
This is a good idea. The template engine should be able to check if the value it's operating on is an object or not, and if it's not an object give it the appropriate |
@GuySartorelli added this to the 5.3 milestone. This looks like the potential for a quick win. I added a very generic AC just to avoid pre-judging of the best way of doing this I'm thinking of the top of my head:
|
The first two options there are just an implementation detail, really. Whether That third option would have to be in a major release, and goes in the wrong direction imo. I'd prefer to see |
PRs merged |
Description
It would be great if we were able to pass simple numeric/non-associative arrays to Silverstripe templates for them to be output. MVP for me would also be when those arrays only contain simple data types (
string
,int
,float
, etc).I think this is probably felt most (for me) when working with external data sources. Trying to output some simple indexed content all of a sudden requires a bunch of processing before you can return it to your template.
As an aside, in Silverstripe 3, this would work:
But now in Silverstripe 4 and 5, this results in an error:
Noting though, that I'd probably prefer to avoid needing to convert my
array
to anArrayList
, as that still requires processing.Additional context or points of discussion
No response
Acceptance criteria
New issues created
Kitchen-sink CI run
PRs
The text was updated successfully, but these errors were encountered: