-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Trac63946/rest lazy load namespaces #10080
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
Open
prettyboymp
wants to merge
16
commits into
WordPress:trunk
Choose a base branch
from
prettyboymp:trac63946/rest-lazy-load-namespaces
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
231d69a
Introduce namespace registration to WP_REST_Server for the purpose of…
prettyboymp 0e5dfe1
Add global register_rest_namespace() function.
prettyboymp 0cd30fb
fix typo
prettyboymp 9f03c55
remove .idea files
prettyboymp 8d1c50c
lint fixes
prettyboymp a06b8ff
remove ide files
prettyboymp cb1b98a
remove todos
prettyboymp ab5ee05
Update test_get_namespace_index() to make sure functionality doesn't …
prettyboymp d5c5312
More lint fixes for tests
prettyboymp 6195c42
More lint
prettyboymp 093d3fe
Equals alignment
prettyboymp 98e2d2f
missed alignment
prettyboymp c0b3502
Improve documentation around route_context.
prettyboymp ed30e4c
Add docblock for the 'rest_lazy_load_namespace_' . $route_namespace a…
prettyboymp f9152af
Add general `rest_lazy_load_namespace` hook.
prettyboymp 9233b0f
Address review feedback for lazy namespace loading.
prettyboymp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This somewhat breaks from convention around only using underscores for hooks since by their own convention namespaces are almost always going to contain dashes and slashes. Would it be better to convert these for the hook for the sake of convention or leave it as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also isn't a recommended pattern anymore. The namespace should just be it's own parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TimothyBJacobs, do you happen to have a reference to some relevant discussion around this? There seem to still be (relatively) recent hooks added with this pattern.
I would hate for every callback created for lazy route registration to have to start with
if( '/my-plugin-namespace' === $route_namespace )....There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually WP provides hooks for both. e.g.
do_action( 'rest_lazy_load_namespace_' . $route_namespace, $route_namespace );anddo_action( 'rest_lazy_load_namespace', $route_namespace );