LLMS_Assets::merge_asset_file( array $asset )

Retrieve dependency and version info from a script asset’s asset.php file


Description Description

Loads the asset.php file (generated via the @wordpress/dependency-extraction-webpack-plugin) and merges it into an existing asset array.


Top ↑

Parameters Parameters

$asset

(array) (Required) An asset definition array.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/class-llms-assets.php

	 * @return array
	 */
	protected function merge_asset_file( $asset ) {

		if ( empty( $asset['asset_file'] ) ) {
			return $asset;
		}

		$asset_file_path = plugin_dir_path( $asset['base_file'] ) . trailingslashit( $asset['path'] ) . $asset['file_name'] . '.asset.php';
		if ( file_exists( $asset_file_path ) ) {
			$info                  = include $asset_file_path;
			$asset['dependencies'] = array_merge( $asset['dependencies'], $info['dependencies'] );
			$asset['version']      = $info['version'];
		}

		return $asset;


Top ↑

Changelog Changelog

Changelog
Version Description
5.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.