-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix stylesheet name issue #731
Conversation
How can the issue be reproduced? |
wp-admin-> Appearance ->Customize
|
That's unexpected. Do you have a The function is supposed to always return a theme, though I can see it won't possibly if you've filtered syntax-highlighting-code-block/syntax-highlighting-code-block.php Lines 331 to 350 in a158c67
For example: add_filter( 'syntax_highlighting_code_block_style', '__return_false' ); The customizer setting validates the syntax-highlighting-code-block/syntax-highlighting-code-block.php Lines 751 to 758 in a158c67
So a call to Is there something else you did on your site to get to this state? |
OK, then as a part of this, we should also update the
|
okay, tested when okay |
inc/functions.php
Outdated
@@ -308,7 +308,7 @@ function register_editor_assets( WP_Block_Type $block ): void { | |||
/** | |||
* Get highlight theme name. | |||
* | |||
* @return string Theme name. | |||
* @return string|null Theme name or null if disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this won't work because of the PHP string
return type. So it will need to rather be:
* @return string|null Theme name or null if disabled. | |
* @return string Theme name or empty string if disabled. |
inc/functions.php
Outdated
@@ -331,7 +331,7 @@ function get_theme_name(): string { | |||
} else { | |||
$style = get_plugin_options()['theme_name']; | |||
} | |||
return $style; | |||
return is_string( $style ) ? $style : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return is_string( $style ) ? $style : null; | |
return is_string( $style ) ? $style : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay fixed
Thank you for the contribution. |
Hotfix for critical error in customize api.
Fatal error: Uncaught DomainException: There is no stylesheet by the name of '' in /app/wp-content/plugins/syntax-highlighting-code-block/vendor/scrivo/highlight-php/HighlightUtilities/_themeColors.php:475 Stack trace: #0 /app/wp-content/plugins/syntax-highlighting-code-block/vendor/scrivo/highlight-php/HighlightUtilities/functions.php(91): _getThemeBackgroundColor(false) #1 /app/wp-content/plugins/syntax-highlighting-code-block/syntax-highlighting-code-block.php(127): HighlightUtilities\getThemeBackgroundColor(false) #2 /app/wp-content/plugins/syntax-highlighting-code-block/syntax-highlighting-code-block.php(776): Syntax_Highlighting_Code_Block\get_default_line_background_color(false) #3 /app/wp-includes/class-wp-hook.php(308): Syntax_Highlighting_Code_Block\customize_register(Object(WP_Customize_Manager)) #4 /app/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #5 /app/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 /app/wp-includes/class-wp-customize-manager.php(934): do_action('customize_regis...', Object(WP_Customize_Manager)) #7 /app/wp-includes/class-wp-hook.php(308): WP_Customize_Manager->wp_loaded('') #8 /app/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #9 /app/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #10 /app/wp-settings.php(645): do_action('wp_loaded') #11 /app/wp-config.php(121): require_once('/app/wp-setting...') #12 /app/wp-load.php(50): require_once('/app/wp-config....') #13 /app/wp-admin/admin.php(34): require_once('/app/wp-load.ph...') #14 /app/wp-admin/customize.php(13): require_once('/app/wp-admin/a...') #15 {main} thrown in /app/wp-content/plugins/syntax-highlighting-code-block/vendor/scrivo/highlight-php/HighlightUtilities/_themeColors.php on line 475
Tested environments: