Fix Mini Cart template part link on WP 5.9 (https://github.com/woocommerce/woocommerce-blocks/pull/5348)
* 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:
parent
865a0a5ffa
commit
29fa0a61e6
|
@ -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',
|
||||
}
|
||||
|
|
|
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue