-
Notifications
You must be signed in to change notification settings - Fork 5
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: disable block if not using sidebars #99
Conversation
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.
Ran into a couple of issues:
Confirm you are no longer able to add the block to a page
This is true, but if you visit a post that previously had the block, you'll see this in its place:
Clicking the button results in a 500 error:
PHP Fatal error: Cannot redeclare scaip_insert_shortcode() (previously declared in /srv/users/user67f0c08d/apps/user67f0c08d/public/wp-content/plugins/super-cool-ad-inserter-plugin/inc/scaip-shortcode-inserter.php:16) in /srv/users/user67f0c08d/apps/user67f0c08d/public/wp-content/plugins/super-cool-ad-inserter/inc/scaip-shortcode-inserter.php on line 16
Thank you for catching that! I realize now that we should have a better strategy for disabling the use of the block instead of removing its registration entirely. 07a223e displays an error message on block edit and modifies the render callback. |
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.
The placement of the error notice is a little strange, but this works for me!
🎉 This PR is included in version 0.6.1-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 0.6.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This PR disables the registration of the SCAIP block if the sidebars are disabled. SCAIP should assume that disabling sidebars means there is another method in place for handling how the ads are registered and rendered. There's no need for it to have its own block in such a case since it can duplicate and potentially conflict with the feature that has taken over.
To fix the integration with the block-based widget editor introduced by WordPress 5.8, this PR also removes the
wp-editor
dependency from the block editor JS. Declaring its dependency does not affect the block behavior.How to test
Block-based widgets
Disabled SCAIP block
Note: If you are running an instance with Jetpack enabled and connected, you might still see the warning due to Automattic/jetpack#20357