Automattic\WooCommerce\Internal\Admin\Onboarding
OnboardingSetupWizard::component_settings
Add profiler items to component settings.
Method of the class: OnboardingSetupWizard{}
Hooks from the method
Returns
array.
Usage
$OnboardingSetupWizard = new OnboardingSetupWizard(); $OnboardingSetupWizard->component_settings( $settings );
- $settings(array) (required)
- Component settings.
OnboardingSetupWizard::component_settings() OnboardingSetupWizard::component settings code WC 11.3.0
public function component_settings( $settings ) {
$profile = (array) get_option( OnboardingProfile::DATA_OPTION, array() );
$settings['onboarding'] = array(
'profile' => $profile,
);
// Home can route to the setup wizard without a page load, so preload the URL whenever setup is still pending.
if ( $this->should_show() && current_user_can( 'manage_woocommerce' ) ) {
$settings['onboarding']['skipOnboardingFallbackUrl'] = add_query_arg(
array(
'action' => self::SKIP_ONBOARDING_SETUP_ACTION,
'_wpnonce' => wp_create_nonce( self::SKIP_ONBOARDING_SETUP_ACTION ),
),
admin_url( 'admin-post.php' )
);
if ( current_user_can( 'view_site_health_checks' ) ) {
$settings['onboarding']['siteHealthUrl'] = admin_url( 'site-health.php' );
}
}
// Only fetch if the onboarding wizard OR the task list is incomplete or currently shown
// or the current page is one of the WooCommerce Admin pages.
if (
( ! $this->should_show() && ! count( TaskLists::get_visible() )
// phpcs:ignore Generic.CodeAnalysis.RequireExplicitBooleanOperatorPrecedence.MissingParentheses
||
! $this->is_woocommerce_page()
)
) {
return $settings;
}
include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-options.php';
$wccom_auth = \WC_Helper_Options::get( 'auth' );
$profile['wccom_connected'] = empty( $wccom_auth['access_token'] ) ? false : true;
$settings['onboarding']['currencySymbols'] = get_woocommerce_currency_symbols();
$settings['onboarding']['euCountries'] = WC()->countries->get_european_union_countries();
$settings['onboarding']['localeInfo'] = include WC()->plugin_path() . '/i18n/locale-info.php';
$settings['onboarding']['profile'] = $profile;
if ( $this->is_setup_wizard() ) {
$settings['onboarding']['pageCount'] = (int) ( wp_count_posts( 'page' ) )->publish;
$settings['onboarding']['postCount'] = (int) ( wp_count_posts( 'post' ) )->publish;
$settings['onboarding']['isBlockTheme'] = wp_is_block_theme();
}
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
return apply_filters( 'woocommerce_admin_onboarding_preloaded_data', $settings );
}