-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Change edit links for templates and template parts #36294
Conversation
|
||
$edit_link = 'themes.php?page=gutenberg-edit-site&postId=%1$s&postType=%2$s'; | ||
|
||
return admin_url( sprintf( $edit_link, urlencode( $template->id ), $template->type ) ); |
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.
The core function uses admin_url
as well instead of the path - https://developer.wordpress.org/reference/functions/get_edit_post_link/
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.
Sorry for nitpicking, @kevin940726.
The feature works as expected.
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.
I had some feedback, but it was resolved in 2165683.
Is there a possibility to add a unit test (or tests) for gutenberg_get_edit_template_link
function?
I can add them if you wish so, @kevin940726.
@anton-vlasenko It's yours now! ❤️ |
It's working well, but this change exposed another related issue. When editing a template now, clicking the W button takes you back to the Dashboard. This is inconsistent with editing posts and pages, where clicking the W takes you to the relevant list view. Should we address that here or in a follow-up? |
@jameskoster, I think we should handle that in a separate PR. I can do a follow-up later today. |
Excellent. To clarify:
I mention this since the Editor (beta) link effectively takes you to the same place as editing a template. |
return $link; | ||
} | ||
|
||
$edit_link = 'themes.php?page=gutenberg-edit-site&postId=%1$s&postType=%2$s'; |
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.
Shouldn't we use build_query
to build $edit_link
?
cc @Mamaduka
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.
I think it's a simple enough query that there's no need to use build_query
or add_query_arg.
P.S. In the future, this path can be a part of a post type of object via the _edit_link
argument.
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.
There is a library function for building queries, and it feels like we are inventing the wheel here.
But I'm not going to insist we need to change it because we encode the request parameters (as it should be).
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.
I've added a unit test.
LGTM now.
Thank you, @anton-vlasenko. |
Description
Close #35990.
Edit the "Edit" link of the items in Templates and Template Parts list to point to Site Editor.
How has this been tested?
tt1-blocks
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).