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

Refactor which custom properties are queried for in collection entries #2051

Merged
merged 11 commits into from
Sep 30, 2024

Conversation

sebnitu
Copy link
Owner

@sebnitu sebnitu commented Sep 30, 2024

What changed?

This PR refactors which custom properties are queried when getCustomProps is called. Instead of searching every key in the entry.context.settings object, we now use the entry.getSetting("customProps") method to return an array of all the props to query custom properties for.

As part of this update, getSetting has also been refactored into a modular helper function which is then imported and applied as the entry method getSetting. It can now take an options object for setting a fallback value in cases where a setting doesn't exist as well as a props array with the order of properties to check for the setting. This allows for adjusting the order or adding on to the settings query.

@sebnitu sebnitu changed the title Refactor which and how custom properties are queried for collection entries Refactor which custom properties are queried for in collection entries Sep 30, 2024
@sebnitu sebnitu marked this pull request as ready for review September 30, 2024 16:54
@sebnitu sebnitu merged commit a0d3d6d into next Sep 30, 2024
2 checks passed
@sebnitu sebnitu deleted the next-custom-props branch September 30, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant