Skip to content

Commit

Permalink
wpcomsh: Remove Gutenberg site logo hotfix from 2021 (#39462)
Browse files Browse the repository at this point in the history
  • Loading branch information
mreishus authored and gogdzl committed Oct 25, 2024
1 parent 90681a7 commit 852d7a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 43 deletions.
3 changes: 1 addition & 2 deletions projects/plugins/wpcomsh/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// PhanImpossibleCondition : 3 occurrences
// PhanTypeArraySuspiciousNullable : 3 occurrences
// PhanUndeclaredClassMethod : 3 occurrences
// PhanUndeclaredFunctionInCallable : 3 occurrences
// PhanNoopNew : 2 occurrences
// PhanTypeVoidArgument : 2 occurrences
// PhanUndeclaredProperty : 2 occurrences
Expand All @@ -35,6 +34,7 @@
// PhanTypeObjectUnsetDeclaredProperty : 1 occurrence
// PhanUndeclaredClassConstant : 1 occurrence
// PhanUndeclaredClassStaticProperty : 1 occurrence
// PhanUndeclaredFunctionInCallable : 1 occurrence
// PhanUndeclaredMethod : 1 occurrence

// Currently, file_suppressions and directory_suppressions are the only supported suppressions
Expand All @@ -47,7 +47,6 @@
'endpoints/class-marketplace-webhook-response.php' => ['PhanPluginMixedKeyNoKey'],
'feature-plugins/autosave-revision.php' => ['PhanPluginRedundantAssignment', 'PhanTypeMismatchArgumentNullable'],
'feature-plugins/coblocks-mods.php' => ['PhanUndeclaredClassConstant', 'PhanUndeclaredClassMethod'],
'feature-plugins/gutenberg-mods.php' => ['PhanUndeclaredFunctionInCallable'],
'feature-plugins/managed-plugins.php' => ['PhanRedundantCondition', 'PhanUndeclaredClassMethod', 'PhanUndeclaredFunctionInCallable'],
'feature-plugins/sensei-pro-mods.php' => ['PhanUndeclaredClassMethod'],
'footer-credit/theme-optimizations.php' => ['PhanUndeclaredConstant', 'PhanUndeclaredStaticMethod'],
Expand Down
5 changes: 5 additions & 0 deletions projects/plugins/wpcomsh/changelog/remove-logo-bug
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Removed outdated Gutenberg hotfix from 2021 related to site logos


41 changes: 0 additions & 41 deletions projects/plugins/wpcomsh/feature-plugins/gutenberg-mods.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,47 +41,6 @@ function wpcomsh_remove_gutenberg_experimental_menu() {
remove_submenu_page( 'gutenberg', 'gutenberg-experiments' );
}

/**
* Updates the site_logo option when the custom_logo theme-mod gets updated.
*
* Registered on the `pre_set_theme_mod_custom_logo` hook.
*
* @param mixed $value Attachment ID of the custom logo or an empty value.
* @return mixed
*/
function wpcomsh_sync_custom_logo_to_site_logo( $value ) {
if ( empty( $value ) ) {
delete_option( 'site_logo' );
} else {
update_option( 'site_logo', $value );
}

return $value;
}

/**
* Hotfix a Gutenberg bug that prevents updating a logo from the Customizer.
*
* These fixes are from https://github.com/WordPress/gutenberg/pull/33179, and can be
* removed when that change is released in Gutenberg and all Atomic sites are updated.
*
* Ported from wpcom hotfix: D63662-code
*/
function wpcomsh_hotfix_gutenberg_logo_bug() {
// Only add the filter if Gutenberg is active and the current version is missing the filter.
if (
( defined( 'GUTENBERG_VERSION' ) || defined( 'GUTENBERG_DEVELOPMENT_MODE' ) ) &&
false === has_action( 'pre_set_theme_mod_custom_logo', 'gutenberg__sync_custom_logo_to_site_logo' )
) {
add_filter( 'pre_set_theme_mod_custom_logo', 'wpcomsh_sync_custom_logo_to_site_logo' );
}

// Remove a function that can inadvertently delete your logo.
remove_action( 'update_option_site_logo', 'gutenberg__sync_site_logo_to_custom_logo', 10 );
}
// Wait until after Gutenberg has registered the Site Logo block on the `init` action, priority 10.
add_action( 'init', 'wpcomsh_hotfix_gutenberg_logo_bug', 11 );

/**
* Hotfix a Gutenberg bug that inadvertently loads wp-reset-editor-syles stylesheet in the
* iframed site editor.
Expand Down

0 comments on commit 852d7a9

Please sign in to comment.