cms icon indicating copy to clipboard operation
cms copied to clipboard

[5.x] Bring back select modifier

Open jasonvarga opened this issue 1 year ago • 1 comments

This brings back the select modifier from #10183 which got reverted in #10218 because of #10211.

Except this will also fix the issue.

Todo:

  • [ ] Add test that shows the bug
  • [ ] Fix bug

jasonvarga avatar May 29 '24 14:05 jasonvarga

@JohnathonKoster This one is probably for you 😄

I've tracked it down to here:

https://github.com/statamic/cms/blob/af63932001987fc4c7eb0fa0a2f4096144a19f99/src/View/Antlers/Language/Runtime/NodeProcessor.php#L1401-L1405

When you use {{ *recursive children* }}, it ends up looking at the outer nav tag, seeing the select="" parameter, deciding that yes select is (now) a modifier, and then tries to run the modifier.

I believe this works this way so you can use scope as per this: https://github.com/statamic/cms/blob/dae2639b98a07976e61460c3fa6c953bc0ab956a/tests/Antlers/Runtime/TemplateTest.php#L703-L713

Making this change fixes it and lets scope continue to work, but obviously just scope. I can't really think of if that's a problem or not.

-if (ModifierManager::isModifier($param)) {
+if ($param->name === 'scope') {

jasonvarga avatar May 29 '24 19:05 jasonvarga