Automattic\WooCommerce\Blocks

AssetsController::register_style()protectedWC 1.0

Registers a style according to wp_register_style.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->register_style( $handle, $src, $deps, $media, $rtl );
$handle(строка) (обязательный)
Name of the stylesheet. Should be unique.
$src(строка) (обязательный)
Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
$deps(массив)
An array of registered stylesheet handles this stylesheet depends on.
По умолчанию: empty array
$media(строка)
The media for which this stylesheet has been defined. Accepts media types like 'all', 'print' and 'screen', or media queries like '(orientation: portrait)' and '(max-width: 640px)'.
По умолчанию: 'all'
$rtl(true|false)
Whether or not to register RTL styles.
По умолчанию: false

Код AssetsController::register_style() WC 8.7.0

protected function register_style( $handle, $src, $deps = array(), $media = 'all', $rtl = false ) {
	$filename = str_replace( plugins_url( '/', dirname( __DIR__ ) ), '', $src );
	$ver      = self::get_file_version( $filename );

	wp_register_style( $handle, $src, $deps, $ver, $media );

	if ( $rtl ) {
		wp_style_add_data( $handle, 'rtl', 'replace' );
	}
}