Automattic\WooCommerce\Blocks\Assets

AssetDataRegistry::get_core_data()protectedWC 1.0

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.

Метод класса: AssetDataRegistry{}

Хуков нет.

Возвращает

Массив. An array containing core data.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_core_data();

Код AssetDataRegistry::get_core_data() WC 8.7.0

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' ),
		'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' ),
	];
}