-
Notifications
You must be signed in to change notification settings - Fork 284
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Implement additional googlesitekit-site store selectors #1000
Comments
@tofumatt Regarding the |
Thanks for waiting for a response on this IB; finally getting back to it! 😅 To answer your question about using resolvers, we should be able to do that. I've updated the IB to mention we'll take that approach (and why). For this particular set of selectors it isn't really needed as a lot of this data will be used for nearly every page, but I like the practice of using resolvers to load the data only once it's been requested, so let's set a good example and do it here! 👍 |
IB ✅ @tofumatt Still, let's call the action |
Oh, yes, totally! I meant to add that from our discussion and it slipped my mind :-) I updated it in the IB 👍 |
@tofumatt Regarding the PHP output to pass the information to JS:
See #1189 for context. |
@tofumatt Would be great if you could prioritize this issue and #1224 (once that's fully defined) over the next days/week as #1101 (which @aaemnnosttv will work on) will require parts of both. Let's make sure to fully stick to the selectors/actions naming outline we put together in both of the store issues, as the work on #1101 needs to already start in the meantime, assuming that those will be the selectors/actions available. |
Ran regression around basic functionality. Installed and setup SK, connected all modules, confirmed functionality, disconnected modules, disconnected SK, deactivated and removed SK. Reinstalled and confirmed everything remained functional after setup a 2nd time. Passed QA ✅ |
Feature Description
Following #999, the
core/site
store should include further selectors for data that is passed to JS via PHP. These changes should be added to thegooglesitekit-site
script.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
core/site
store should have the following additional selectors (for data passed from PHP):getReferenceSiteURL()
getHomeURL()
getAdminURL()
getAMPMode()
isAMP()
ampMode
value from PHP, basically just!! ampMode
getCurrentReferenceURL()
Context::get_reference_canonical()
getCurrentEntityType()
post
, orhome
, or nothinggetCurrentEntityTitle()
getCurrentEntityID()
before_print
callback in PHP that adds the data to some specific JS global (_googlesitekitSiteData
), solely for consumption by that scriptImplementation Brief
before_print
option to the asset entry inAssets.php
created in Scaffold googlesitekit-site package and core/site store #999 that adds all relevant data from PHP for the selector to consume when registered. I'd actually like this global data to be deleted after the resolver (see below) so we don't leave globals around and accidentally use them 😄receiveSiteInfo()
action to populate the data from the global data passed from PHP after any selector that relies on the data inreceiveSiteInfo()
is called. This can use the resolver pattern used in Gutenberg so that data is loaded only when needed. In this case the data will often be needed, but it's a good precedent to set for other selectors.Changelog entry
core/site
datastore.The text was updated successfully, but these errors were encountered: