Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Add 'ids' collection param for settings and partials to allow a set of dynamic items to be fetched #17

Open
westonruter opened this issue Jul 21, 2017 · 0 comments

Comments

@westonruter
Copy link
Member

One use case in Customize Posts plugin is to fetch the settings for dynamic settings on demand. The customize-posts-fetch-settings admin ajax request takes a post_ids param and then returns the setting params for any post settings for these IDs. See the source: https://github.com/xwp/wp-customize-posts/blob/d87ff821ddb4611a1bade7859498cbb97d2b77ac/php/class-wp-customize-posts.php#L1473-L1499

Something like this should be possible with the REST API as well. I should be able to make a request to:

/wp-json/customize/v1/settings?ids=post[page][1],post[page][3],post[page][3]

And this should return a collection of just these three settings, which may or may not have been dynamically created.

Such an ids param would be similar to the include param in the posts endpoint: https://github.com/WordPress/wordpress-develop/blob/94d95184b04ccb49f593720ffb04fb0e36da23e5/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php#L2100-L2107

Maybe the include name actually should be used instead even. The key thing is to just pass the array supplied to this param to the add_dynamic_settings method.

This should also be done for partials, sync they can also be dynamic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant