Add support for sharing data in Script Modules and improve documentation
Please check if the PR fulfills these requirements
- [x] The commit message follows our guidelines
- [x] Tests for the changes have been added (for bug fixes/features)
- [x] Docs have been added/updated (for bug fixes/features)
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Allow Scripts Modules to share data from the server to the client module. It does that via a filter available since wp 6.5
What is the current behavior? (You can also link to an open issue here)
Scripts Modules are not allowed to share any kind of data from the server
What is the new behavior (if this is a feature change)?
Share data from the server
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No, I specifically avoided to introduce the DataAwareTrait in ScriptsModules since it would require a refactoring of the same trait due to the withCondition method.
Other information
Codecov Report
:x: Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 87.48%. Comparing base (a8a8ba8) to head (3757bfc).
:warning: Report is 3 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/Handler/ScriptModuleHandler.php | 88.88% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #65 +/- ##
============================================
+ Coverage 86.79% 87.48% +0.69%
- Complexity 315 318 +3
============================================
Files 27 27
Lines 901 919 +18
============================================
+ Hits 782 804 +22
+ Misses 119 115 -4
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 87.48% <91.30%> (+0.69%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Hi @cristianobaptista and @Chrico I've made the latest changes, are there any other things you would like to discuss?