LLMS_Assets::prepare_inline_asset_for_output( array $asset, string $location )

Prepares an inline asset definition for being output.


Description Description

When $this->debugging_assets is true this will add line breaks between each inline asset and output the asset’s handle as a comment before the asset’s script/style so that the inline assets can be quickly located and reviewed in the generated source of the page.


Top ↑

Parameters Parameters

$asset

(array) (Required) The inline asset definition array.

$location

(string) (Required) The location of the asset. Accepts "header", "footer", or "style".


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-llms-assets.php

	 * @return string
	 */
	protected function prepare_inline_asset_for_output( $asset, $location ) {

		$before = '';
		$after  = '';

		// Output inline asset handles and add line breaks when debugging.
		if ( $this->debugging_assets ) {

			// Setup the comment template.
			$before = 'style' === $location ? '/* %s. */' : '// %s.';

			// Add line breaks.
			$before .= "\n";
			$after   = "\n";

		}

		return sprintf( $before, $asset['handle'] ) . $asset['asset'] . $after;


Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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