Automattic\WooCommerce\Blocks\BlockTypes
AbstractBlock::register_frontend_script_asset
Register the frontend script asset.
Метод класса: AbstractBlock{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->register_frontend_script_asset( $frontend_script );
- $frontend_script(массив) (обязательный)
- The frontend script data.
Код AbstractBlock::register_frontend_script_asset() AbstractBlock::register frontend script asset WC 11.2.1
private function register_frontend_script_asset( $frontend_script ) {
$handle = (string) $frontend_script['handle'];
$path = (string) $frontend_script['path'];
$dependencies = array_merge(
(array) $frontend_script['dependencies'],
$this->integration_registry->get_all_registered_script_handles()
);
$data = $this->asset_api->get_script_data( $path );
$has_i18n = in_array( 'wp-i18n', $data['dependencies'], true );
$this->asset_api->register_script(
$handle,
$path,
$dependencies,
$has_i18n
);
}