Skip to content
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

Update "Edit site" admin bar link to open Site Editor at top level #63835

Open
wants to merge 7 commits into
base: trunk
Choose a base branch
from
38 changes: 38 additions & 0 deletions lib/compat/wordpress-6.8/admin-bar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Changes to the WordPress admin bar.
*
* @package WordPress
*/

/**
* Adds the "Site Editor" link to the Toolbar.
*
* @since 5.9.0
* @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar.
* @since 6.6.0 Added the canvas argument to the url.
* @since 6.8.0 Changed to open Site Editor at top level instead of specific template.
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
*/
function gutenberg_wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
// Don't show if a block theme is not activated.
if ( ! wp_is_block_theme() ) {
return;
}

// Don't show for users who can't edit theme options or when in the admin.
if ( ! current_user_can( 'edit_theme_options' ) || is_admin() || ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) ) {
return;
}

$wp_admin_bar->add_node(
array(
'id' => 'site-editor',
'title' => __( 'Edit site' ),
'href' => admin_url( 'site-editor.php' ),
)
);
}

add_action( 'admin_bar_menu', 'gutenberg_wp_admin_bar_edit_site_menu', 41 );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.8/post.php';
require __DIR__ . '/compat/wordpress-6.8/site-editor.php';
require __DIR__ . '/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php';
require __DIR__ . '/compat/wordpress-6.8/admin-bar.php';

// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
Expand Down
9 changes: 8 additions & 1 deletion packages/block-library/src/image/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
"name": "core/image",
"title": "Image",
"category": "media",
"usesContext": [ "allowResize", "imageCrop", "fixedHeight", "postId", "postType", "queryId" ],
"usesContext": [
"allowResize",
"imageCrop",
"fixedHeight",
"postId",
"postType",
"queryId"
],
"description": "Insert an image to make a visual statement.",
"keywords": [ "img", "photo", "picture" ],
"textdomain": "default",
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-content/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@
},
"style": "wp-block-post-content",
"editorStyle": "wp-block-post-content-editor"
}
}
Loading