Automattic\WooCommerce\Blocks\BlockTypes

CouponCode::enqueue_data │ protected │ WC 1.0

Expose coupon types to the editor JS via AssetDataRegistry.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->enqueue_data( $attributes ): void;
$attributes(массив)
Block attributes.
По умолчанию: array()

Код CouponCode::enqueue_data() WC 11.3.0

protected function enqueue_data( array $attributes = array() ): void {
	parent::enqueue_data( $attributes );

	if ( ! $this->asset_data_registry->exists( 'couponTypes' ) && function_exists( 'wc_get_coupon_types' ) ) {
		$this->asset_data_registry->add( 'couponTypes', wc_get_coupon_types() );
	}
}