-
Notifications
You must be signed in to change notification settings - Fork 110
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
Mods: generalize manual activation #1147
Conversation
The tab display is independent from its manual activation. Any module could have extra settings (e.g. ACF). Make the display dependent on the module state instead. Add a new `has_settings` field in the module defintions. Rename `load_modules_enabled` to `load_active_modules`.
8759262
to
8e6d062
Compare
@@ -73,6 +75,7 @@ public static function update_manual_enabled_modules() { | |||
if ( $changed ) { | |||
update_option( 'qtranslate_modules', $options_modules ); | |||
self::load_active_modules(); | |||
// TODO remove this action |
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.
We need to give opportunity to modules to perform activation/deactivation actions (e.g. flush rewrite rules for slugs module) on manual state change.
I don't see other clean ways than a do_action
here...
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.
I know it's needed, but using a hook for something purely internal is a hack. No need to fix this now but it can always be designed differently ;)
The hooks are the main reason why WordPress became so popular, and one of the reasons this framework is such a huge mess.
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.
A few things fixed on the fly. Will merge but there will be other changes to come.
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.
Good extension. There will be a follow-up.
Fix regression on front side with the new module handler. This a quickfix, there should not be any deps in that direction.
The change with `array_merge` introduced a regression. Default values can't be applied because the unchecked options are not part of the `$_POST` data. Yet another quickfix, a proper fix would require more changes.
Reorganize code by moving admin updates to admin source files. Refactor without the recently added `qtx_modules_update` action. Re-use `qtranslate_save_config` which is almost equivalent, except the rules will be rewritten in any case when slugs is activated, regardress of the changes in options or not. Remove other option change detection, not really needed.
With
slugs
we introduced the manual activation of a module, adding a checkbox in the integration panel (admin).Extend this feature to any module, so the activation checkbox is displayed for any module.
This checkbox only applies when all the conditions are met to activate the module (parent plugin activated and no incompatible plugin).