Gets the highest fetch priority for the provided script IDs.
Parameters
$idsstring[]required- Script module IDs.
Source
private function get_highest_fetchpriority( array $ids ): string {
static $high_priority_index = null;
if ( null === $high_priority_index ) {
$high_priority_index = count( $this->priorities ) - 1;
}
$highest_priority_index = 0;
foreach ( $ids as $id ) {
if ( isset( $this->registered[ $id ] ) ) {
$highest_priority_index = (int) max(
$highest_priority_index,
(int) array_search( $this->registered[ $id ]['fetchpriority'], $this->priorities, true )
);
if ( $high_priority_index === $highest_priority_index ) {
break;
}
}
}
return $this->priorities[ $highest_priority_index ];
}
Changelog
| Version | Description |
|---|---|
| 6.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.