-
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
Site Editor → Page Details: Link 'Last modified' detail to revisions #51343
Comments
@jameskoster is this safe to punt to 6.4, or is this being actively worked on? Just trying to tidy up the 6.3 Board 😅 |
Fine to punt 👍 |
@ramonjd Thanks for adding the revisions link but I don't think we can quite close this issue yet as the second part ("Update 'Go to editor' link on Revisions page so that it returns you to the site editor") is not implemented. |
No worries. The issue was probably auto-closed by the PR merged. I thought the link would be best left for another PR as it will involve some PHP changes, and potential Core patches. |
I've been investigating this, and am a bit unsure how to proceed. So I'll post my thoughts first 😄 The return to post links on the revisions page is generated from a template, unique to each post type object. Currently, admin/revision.php builds the link by calling get_edit_post_link(), which uses the link template from page_object->_edit_link. For most post types, including pages and posts, the
Now we want to that template to vary depending on the origin of the referring URL. That means, if we're coming from the Site Editor, the return template should be something similar to what the wp_template post object uses, which is I see a few challenges:
I'm not sure if any of this is a good idea. 🤷🏻 In the plugin it can be done I think without great fuss using the get_edit_post_link filter. With it we can return whatever we want. function gutenberg_update_get_edit_post_link_page_from_site_editor( $link, $post_id ) {
$post = get_post( $post_id );
if ( 'page' === $post->post_type && 'revision' === get_current_screen()->base && isset( $_GET['editor'] ) ) {
if ( 'site' === sanitize_text_field( $_GET['editor'] ) ) {
$post_edit_link = 'site-editor.php?' . build_query(
array(
'postType' => '%s',
'postId' => '%s',
'canvas' => 'edit',
)
);
return admin_url( sprintf( $post_edit_link, $post->post_type, $post_id ) );;
}
}
return $link;
}
add_filter( 'get_edit_post_link', 'gutenberg_update_get_edit_post_link_page_from_site_editor', 10, 2 ); We would just have to come up with migration approach for Core. cc @draganescu if he has time since he worked on https://core.trac.wordpress.org/ticket/57709 |
@ramonjd possibly a dumb idea, but could the 'Go to editor' link behave like the browser back button when there is an internal referrer? |
Very good question! That crossed my mind, but we'd also want to be able to build the link from wherever we are (and from wherever we've come).
|
I suppose we can close this after all since it's a core issue. Feel free to re-open if you prefer. |
Thanks! I'll make a note to create a trac issue. Hopefully folks will contribute some interesting suggestions as to how we can build this into core. |
Trac ticket: https://core.trac.wordpress.org/ticket/59419 |
Follow-up to #50390.
Here's the Page details panel in the site editor:
The 'Last modified' detail could be more useful if it linked to revisions, as it does in the Styles panel:
The revisions page in wp-admin includes a "Go to editor" link:
Ideally that link can be updated to conditionally return you to the correct view.
The text was updated successfully, but these errors were encountered: