Automattic\WooCommerce\Blocks
AssetsController::register_style()
Registers a style according to wp_register_style.
Method of the class: AssetsController{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->register_style( $handle, $src, $deps, $media, $rtl );
- $handle(string) (required)
- Name of the stylesheet. Should be unique.
- $src(string) (required)
- Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
- $deps(array)
- An array of registered stylesheet handles this stylesheet depends on.
Default: empty array - $media(string)
- 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)'.
Default: 'all' - $rtl(true|false)
- Whether or not to register RTL styles.
Default: false
AssetsController::register_style() AssetsController::register style code 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' ); } }