Automattic\WooCommerce\Blocks\Assets
Api::register_style()
Registers a style according to wp_register_style.
Метод класса: Api{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$Api = new Api(); $Api->register_style( $handle, $relative_src, $deps, $media );
- $handle(строка) (обязательный)
- Name of the stylesheet. Should be unique.
- $relative_src(строка) (обязательный)
- Relative source of the stylesheet to the plugin path.
- $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'
Список изменений
С версии 2.5.0 | Введена. |
С версии 2.6.0 | Change src to be relative source. |
Код Api::register_style() Api::register style WC 7.3.0
public function register_style( $handle, $relative_src, $deps = [], $media = 'all' ) { $filename = str_replace( plugins_url( '/', __DIR__ ), '', $relative_src ); $src = $this->get_asset_url( $relative_src ); $ver = $this->get_file_version( $filename ); wp_register_style( $handle, $src, $deps, $ver, $media ); }