-
Notifications
You must be signed in to change notification settings - Fork 107
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
short circuit "QTX_Admin_Gutenberg" #1112
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.
If you need to disable all the QTX functionalities for Gutenberg, there's a better way.
The instance should not be created so the filter call should be done in qtx_admin_gutenberg.php
before requiring the file.
I wanted to do so. But who guarantees that at the time of creating an instance this filter will be already added? There is no guarantee that even a plugin that wants to do it is already loaded (QTX can be loaded before it). That is why I did it that way. |
Right, I see. Currently the instance is created from One solution could be to delay the creation of this object, because it's only dependent on Another way could be to have a user option to disable the whole Gutenberg functionality. But I'm not sure it's better. |
A third possibility would be to give the possibility to delete the object later instead of keeping it alive but having to check an external state in every function. Perhaps that would be a cleaner way to remove all filters. The cleanup would be done in the destructor. |
yes, but hardly users will disable it. It is necessary to developers and third-party plugins. Therefore, my option is simple and will work with any future evolutions. Although not so elegant. |
Why do you need to disable these filters? Is it related to #1097 and https://github.com/picasso/zu-translate? |
yes, I need to re-implement the support for Gutenberg and the current implementation interferes to me. |
The object is so small that it makes no sense to optimize this process too much. Let it stay in memory, this is a small loss (IMHO) |
The idea of the object was to facilitate the deactivation of the filters (in the destructor), but this doesn't matter much. |
Wait a bit. I began to make changes to my plugin because I have to return the functionality of the previous |
My research has shown that
But in the current situation, I managed with one filter. You can add 2 filters for the future, or you can make one filter and wait for the situation when someone needs 2 filters. I suggest calling the filter |
Rename to `qtranslate_admin_block_editor` Invert boolean to signify "enable qtx handling" -> true by default.
I've renamed to |
Yes, it is quite suitable. I will change my logic from |
Add default value for qtranslate_admin_block_editor filter based on config post_type_excluded value. Enhnces work form the merged PR qtranslate#1112 short circuit "QTX_Admin_Gutenberg"
apply filter to short circuit the Admin handler for Gutenberg.
It is very necessary if you implement your processing for the Gutenberg Block Editor and the related REST API.
Otherwise, you have to remove each filter and the action separately and sometimes with hacks...