Automattic\WooCommerce\Blocks\Assets
AssetDataRegistry::get_core_data()
Exposes core data via the wcSettings global. This data is shared throughout the client.
Settings that are used by various components or multiple blocks should be added here. Note, that settings here are global so be sure not to add anything heavy if possible.
Method of the class: AssetDataRegistry{}
No Hooks.
Return
Array
. An array containing core data.
Usage
// protected - for code of main (parent) or child class $result = $this->get_core_data();
AssetDataRegistry::get_core_data() AssetDataRegistry::get core data code WC 9.2.3
protected function get_core_data() { return [ 'adminUrl' => admin_url(), 'countries' => WC()->countries->get_countries(), 'currency' => $this->get_currency_data(), 'currentUserId' => get_current_user_id(), 'currentUserIsAdmin' => current_user_can( 'manage_woocommerce' ), 'currentThemeIsFSETheme' => wc_current_theme_is_fse_theme(), 'dateFormat' => wc_date_format(), 'homeUrl' => esc_url( home_url( '/' ) ), 'locale' => $this->get_locale_data(), 'dashboardUrl' => wc_get_account_endpoint_url( 'dashboard' ), 'orderStatuses' => $this->get_order_statuses(), 'placeholderImgSrc' => wc_placeholder_img_src(), 'productsSettings' => $this->get_products_settings(), 'siteTitle' => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), 'storePages' => $this->get_store_pages(), 'wcAssetUrl' => plugins_url( 'assets/', WC_PLUGIN_FILE ), 'wcVersion' => defined( 'WC_VERSION' ) ? WC_VERSION : '', 'wpLoginUrl' => wp_login_url(), 'wpVersion' => get_bloginfo( 'version' ), ]; }