Automattic\WooCommerce\Internal\Admin
WCAdminAssets::get_script_asset_filename()
Gets a script asset registry filename. The asset registry lists dependencies for the given script.
Метод класса: WCAdminAssets{}
Хуков нет.
Возвращает
Строку
. complete asset filename.
Использование
$result = WCAdminAssets::get_script_asset_filename( $script_path_name, $file );
- $script_path_name(строка) (обязательный)
- Path to where the script asset registry is contained.
- $file(строка) (обязательный)
- File name (without extension).
Код WCAdminAssets::get_script_asset_filename() WCAdminAssets::get script asset filename WC 9.3.3
public static function get_script_asset_filename( $script_path_name, $file ) { $minification_supported = Features::exists( 'minified-js' ); $script_min_filename = $file . '.min.asset.php'; $script_nonmin_filename = $file . '.asset.php'; $script_asset_path = WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . $script_path_name . '/'; // Check minification is supported first, to avoid multiple is_readable checks when minification is // not supported. if ( $minification_supported && is_readable( $script_asset_path . $script_min_filename ) ) { return $script_min_filename; } elseif ( is_readable( $script_asset_path . $script_nonmin_filename ) ) { return $script_nonmin_filename; } else { // could not find an asset file, throw an error. throw new \Exception( 'Could not find asset registry for ' . $script_path_name ); } }