Closed Biont closed 1 day ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.84%. Comparing base (
2119d0e
) to head (03af2d4
). Report is 2 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
We should also update the documentation and mention that the data in PluginProperties
is not translated (and why). I guess it is also a good opportunity to add a note about the change done in https://github.com/inpsyde/modularity/pull/40 .
@Chrico Added!
Sorry I need to jump in with another request...first of all: I think this is a breaking change for existing Packages, in case they are using something from the PluginProperties
and relying on translated strings.
We should not break the default behavior, but at least fix the _doing_it_wrong()
-calls.
In order to stay "backward compatible", we should add a check for the WP version to be < 6.7
, to ensure that the current behavior stays as it is. If the current WP version is >= 6.7
and we're calling too early get_plugin_data()
, than we should set this to false
. I guess something like did_action('after_setup_theme') || current_action('after_setup_theme');
would work here, right?
There are probably some Plugins out there, which are booted late - so after after_setup_theme
, like on init
. This would not trigger the _doing_it_wrong()
and allow to get translated get_plugin_data()
.
I guess something like did_action('after_setup_theme') || current_action('after_setup_theme'); would work here, right?
Your request makes sense and according to how I understand the situation, this should be a working approach, since it is essentially the same check that WP does before throwing the __doing_it_wrong
. I'll make the edit after the weekend
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) Bug fix
What is the current behavior? (You can also link to an open issue here) WordPress 6.7 removed the need to
load_plugin_textdomain
manually. In return, we receive a notice if translations are loaded/accessed too early.What is the new behavior (if this is a feature change)?
Passing
$translate = false
in the call toget_plugin_data
avoids the_doing_it_wrong
and the resulting noticeSince
ExecutableModule
is responsible for hooking module logic into WordPress, it makes sense to bootstrap the package itself as early as feasible. Hence, deferring bootstrap toafter_setup_thene
orinit
as proposed by core severely limits our flexibility in terms of what modules can to in the "remaining time"Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No.
Other information: