LLMS_Assets::get_inline_priority( float $priority, array $inline_assets = array() )

Auto-increment inline asset priority to prevent duplicates.


Description Description

This ensures that inline assets are always enqueued with a unique priority for their requested location.


Top ↑

Parameters Parameters

$priority

(float) (Required) Requested enqueue priority.

$inline_assets

(array) (Optional) List of existing inline assets for the requested location.

Default value: array()


Top ↑

Return Return

(float)


Top ↑

Source Source

File: includes/class-llms-assets.php

	protected function get_inline_priority( $priority, $inline_assets = array() ) {

		$priority = floatval( $priority );

		if ( $inline_assets ) {

			$priorities = wp_list_pluck( $inline_assets, 'priority' );
			while ( in_array( $priority, $priorities, true ) ) {
				$priority += 0.01;
			}
		}

		return $priority;

	}


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.