Simplify inline module data handling.
Feature Description
As suggested by @aaemnnosttv on Slack, we should follow up on the work started in #10988 and simplify the implementation.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
For example, change this:
return array(
self::MODULE_SLUG => $data,
);
to this:
Test Coverage
QA Brief
Note: I copied these steps from #10988, as the main check here is also just to ensure none of the data went missing.
- Set up Site Kit with Analytics and Ads enabled.
- Go to the Site Kit page.
- Type
_googlesitekitModulesData in the console.
- The object should have an
ads key, whose value is an object containing:
supportedConversionEvents: an array of supported conversion events.
- As a sanity check, install WooCommerce. This array should contain WooCommerce-related events (
add-to-cart, purchase).
- The object should have an
analytics-4 key, whose value is an object containing:
customDimensionsDataAvailable
isWebDataStreamUnavailable
resourceAvailabilityDates
tagIDMismatch
newEvents
lostEvents
newBadgeEvents
- Without setting up Sign In With Google, the object should not have
sign-in-with-google.
- After setting up Sign In With Google, the object should have the
sign-in-with-google key, whose value is an object containing:
isWooCommerceActive
isWooCommerceRegistrationEnabled
Changelog entry
- Simplify inline module data handling.
Simplify inline module data handling.
Feature Description
As suggested by @aaemnnosttv on Slack, we should follow up on the work started in #10988 and simplify the implementation.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Module_With_Inline_Data_Traittrait should be removed, while keeping theModule_With_Inline_Datainterface.Modules::inline_modules_data()method should be updated to iterate over modules that implement the interface and collect their data.get_inline_data, with slug-based keying handled by theModulesclass.Implementation Brief
Module_With_Inline_Data_Traittrait from the following modules:get_inline_data()method in those classes to return the inline data directly, without keying it by the module slug.For example, change this:
to this:
inline_modules_datamethod inModules.phpto populate the inline data from modules that implement theModule_With_Inline_Datainterface. Each module's inline data should be added to$modules_data, using the module's slug ($module::MODULE_SLUG) as the key and the data returned by$module->get_inline_data()as the value.Module_With_Inline_Data_Trait.phpfile.Test Coverage
Analytics_4Test.php,AdsTest.php,Sign_In_With_GoogleTest.php) to use theget_inline_datamethod directly instead of relying on thegooglesitekit_inline_modules_datahook.ModulesTest.phpto cover theinline_modules_datamethod and verify that it correctly adds theinline_module_dataof classes that implement theModule_With_Inline_DatainterfaceQA Brief
Note: I copied these steps from #10988, as the main check here is also just to ensure none of the data went missing.
_googlesitekitModulesDatain the console.adskey, whose value is an object containing:supportedConversionEvents: an array of supported conversion events.add-to-cart,purchase).analytics-4key, whose value is an object containing:customDimensionsDataAvailableisWebDataStreamUnavailableresourceAvailabilityDatestagIDMismatchnewEventslostEventsnewBadgeEventssign-in-with-google.sign-in-with-googlekey, whose value is an object containing:isWooCommerceActiveisWooCommerceRegistrationEnabledChangelog entry