mirror of
https://github.com/getgrav/grav.git
synced 2026-07-11 17:43:36 +02:00
Fix #2781 asset manager pipeline order. Patch taken from @pamtbaau
This commit is contained in:
@@ -59,6 +59,8 @@ class Assets extends PropertyObject
|
||||
protected $collections;
|
||||
protected $timestamp;
|
||||
|
||||
/** @var array to contain next 'order' value per asset 'type', 'group' and 'position' combination */
|
||||
protected $order = [];
|
||||
|
||||
/**
|
||||
* Initialization called in the Grav lifecycle to initialize the Assets with appropriate configuration
|
||||
@@ -190,7 +192,14 @@ class Assets extends PropertyObject
|
||||
$options['timestamp'] = $this->timestamp;
|
||||
|
||||
// Set order
|
||||
$options['order'] = \count($this->$collection);
|
||||
$group = $options['group'] ?? 'head';
|
||||
$position = $options['position'] ?? 'pipeline';
|
||||
|
||||
if (!isset($this->order[$type][$group][$position])) {
|
||||
$this->order[$type][$group][$position] = 0;
|
||||
}
|
||||
|
||||
$options['order'] = $this->order[$type][$group][$position]++;
|
||||
|
||||
// Create asset of correct type
|
||||
$asset_class = "\\Grav\\Common\\Assets\\{$type}";
|
||||
|
||||
Reference in New Issue
Block a user