[5.x] Add support for public properties to PathDataManager #11697
+7
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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