Automattic\WooCommerce\Blocks\Assets
AssetDataRegistry::initialize_core_data()
Used for on demand initialization of asset data and registering it with the internal data registry.
Note: core data will overwrite any externally registered data via the api.
Метод класса: AssetDataRegistry{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->initialize_core_data();
Код AssetDataRegistry::initialize_core_data() AssetDataRegistry::initialize core data WC 9.8.2
protected function initialize_core_data() { /** * Filters the array of shared settings. * * Low level hook for registration of new data late in the cycle. This is deprecated. * Instead, use the data api: * * ```php * Automattic\WooCommerce\Blocks\Package::container()->get( Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry::class )->add( $key, $value ) * ``` * * @since 5.0.0 * * @deprecated * @param array $data Settings data. * @return array */ $settings = apply_filters( 'woocommerce_shared_settings', $this->data ); // Surface a deprecation warning in the error console. if ( has_filter( 'woocommerce_shared_settings' ) ) { $error_handle = 'deprecated-shared-settings-error'; $error_message = '`woocommerce_shared_settings` filter in Blocks is deprecated. See https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/docs/contributors/block-assets.md'; // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion wp_register_script( $error_handle, '' ); wp_enqueue_script( $error_handle ); wp_add_inline_script( $error_handle, sprintf( 'console.warn( "%s" );', $error_message ) ); } // note this WILL wipe any data already registered to these keys because they are protected. $this->data = array_replace_recursive( $settings, $this->get_core_data() ); }