-
-
Notifications
You must be signed in to change notification settings - Fork 576
[5.x] Add support for public properties to PathDataManager #11697
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
base: 5.x
Are you sure you want to change the base?
[5.x] Add support for public properties to PathDataManager #11697
Conversation
Please edit the description to explain the PR. |
Sure, will do. It's currently just a draft. |
This comment was marked as outdated.
This comment was marked as outdated.
A few things:
I know for 3 that this is how it already worked, so its still just as broken, but if we're adding support for outputting properties, they should be able to be used in conditions. It works for methods. |
@jasonvarga I've fixed the points you mentioned. But I'm not sure if all the tests belong in that test class. |
This PR adds support for accessing public properties on plain objects (non-augmentable / non-arrayaccess).
Backstory:
In the Statamic Livewire addon, I've added support for computed properties. Objects returned from there are not always augmentable objects. So I thought it would be nice to be able to process those objects in Antlers, too, meaning calling public methods and accessing public properties (on non-augmentable / non-arrayaccess objects).
I started iterating the path segments and handling all the different types of values/objects myself, but then realized Statamic already can do that (but didn't find the correct place where this is handled in the runtime parser). I had a quick talk with Duncan and John Koster on how to handle that. We (basically John 😅) figured out, it's the
PathDataManager
. This works perfectly, but it currently doesn't check for public properties on objects.https://discord.com/channels/489818810157891584/1360647492701519963