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

FIX Loop over current scope when no argument passed to loop block #11251

Merged

Conversation

GuySartorelli
Copy link
Member

Finishes a feature that was sitting there in a broken state for a while - looping through the current item in scope.

This is kinda a mix between a fix and a new feature - I'm calling it a fix in the commit because the current state is simply broken, but I'm targeting 5 because if someone somehow has a <% loop %> sitting in a template right now (which will be silently failing) they'll get unexpected results after pulling this into their project.

Issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has not been manually edited. The comments were already in the .peg file and were likely manually removed from this file at some stage.

}

//loop without arguments loops on the current scope
if ($res['ArgumentCount'] == 0) {
$on = '$scope->obj(\'Up\', null)->obj(\'Foo\', null)';
$on = '$scope->locally()->obj(\'Me\', null, true)';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is identical to what it renders out if you do a <% loop $Me %>

Copy link
Contributor

@sabina-talipova sabina-talipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It was tested in local environment. Work as expected.

@sabina-talipova sabina-talipova merged commit 76bdc59 into silverstripe:5 May 20, 2024
15 checks passed
@sabina-talipova sabina-talipova deleted the pulls/5/current-scope-loop branch May 20, 2024 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants