Draw the Analytics Screen from the Analytics Dashboard Add-on
Benecaster owns the Analytics menu item and the #/analytics route. The Analytics Dashboard add-on fills one slot, BenecasterAnalyticsScreen, and Benecaster decides, show by show, whether to render it.
The fill receives { showId, path, navigate, setDirty }. path is the rest of the address after /analytics/, so one fill can serve sub-screens such as #/analytics/settings, and navigate( 'settings' ) moves there.
Code
const AnalyticsScreen = ( { showId, path } ) => {
if ( path === 'settings' ) {
return <AnalyticsSettings showId={ showId } />;
}
return <AnalyticsOverview showId={ showId } />;
};
window.BenecasterExtensions?.registerFill( 'BenecasterAnalyticsScreen', AnalyticsScreen );
Need this built rather than just documented? See our services →