* Fix link to edit the Mini Cart template part in WP 5.9

* Use wp_is_block_theme() function

* Add protection against overwriting isSiteEditorAvailable setting

* Rename isSiteEditorAvailable to isBlockTheme
This commit is contained in:
Albert Juhé Lluveras 2021-12-10 11:23:16 +01:00 committed by GitHub
parent 865a0a5ffa
commit 29fa0a61e6
2 changed files with 9 additions and 10 deletions

View File

@ -58,7 +58,7 @@ const MiniCartBlock = ( {
const themeSlug = getSetting( 'themeSlug', '' );
const isSiteEditorAvailable = getSetting( 'isSiteEditorAvailable', false );
const isBlockTheme = getSetting( 'isBlockTheme', false );
/**
* @todo Replace `getColorClassName` and manual style manipulation with
@ -139,7 +139,7 @@ const MiniCartBlock = ( {
}
/>
</PanelBody>
{ isSiteEditorAvailable &&
{ isBlockTheme &&
isString( themeSlug ) &&
themeSlug.length > 0 && (
<PanelBody
@ -150,9 +150,8 @@ const MiniCartBlock = ( {
>
<ExternalLink
href={ addQueryArgs(
`${ ADMIN_URL }themes.php`,
`${ ADMIN_URL }site-editor.php`,
{
page: 'gutenberg-edit-site',
postId: `${ themeSlug }//mini-cart`,
postType: 'wp_template_part',
}

View File

@ -177,17 +177,17 @@ class MiniCart extends AbstractBlock {
''
);
if ( function_exists( 'gutenberg_experimental_is_site_editor_available' ) ) {
if ( function_exists( 'wp_is_block_theme' ) ) {
$this->asset_data_registry->add(
'isSiteEditorAvailable',
gutenberg_experimental_is_site_editor_available(),
false
'isBlockTheme',
wp_is_block_theme(),
true
);
} else {
$this->asset_data_registry->add(
'isSiteEditorAvailable',
'isBlockTheme',
false,
false
true
);
}