mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 04:55:43 +02:00
Merge branch 'NicoHood-asset_order_fix' into develop
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
* Fixed save error when editing accounts that have been created with capital letters in their username [#3211](https://github.com/getgrav/grav/issues/3211)
|
||||
* Fixed renaming flex objects key when using file storage
|
||||
* Fixed wrong values in Admin pages list [#3214](https://github.com/getgrav/grav/issues/3214)
|
||||
* Fixed pipelined asset using different hash when extra asset is added to before/after position [#2781](https://github.com/getgrav/grav/issues/2781)
|
||||
|
||||
# v1.7.5
|
||||
## 02/01/2021
|
||||
|
||||
@@ -92,6 +92,8 @@ class Assets extends PropertyObject
|
||||
protected $collections;
|
||||
/** @var string */
|
||||
protected $timestamp;
|
||||
/** @var array Keeping track for order counts (for sorting) */
|
||||
protected $order = [];
|
||||
|
||||
/**
|
||||
* Initialization called in the Grav lifecycle to initialize the Assets with appropriate configuration
|
||||
@@ -232,7 +234,15 @@ class Assets extends PropertyObject
|
||||
$options['timestamp'] = $this->timestamp;
|
||||
|
||||
// Set order
|
||||
$options['order'] = count($this->$collection);
|
||||
$group = $options['group'] ?? 'head';
|
||||
$position = $options['position'] ?? 'pipeline';
|
||||
|
||||
$orderKey = "{$type}|{$group}|{$position}";
|
||||
if (!isset($this->order[$orderKey])) {
|
||||
$this->order[$orderKey] = 0;
|
||||
}
|
||||
|
||||
$options['order'] = ++$this->order[$orderKey];
|
||||
|
||||
// Create asset of correct type
|
||||
$asset_object = new $type();
|
||||
|
||||
@@ -189,6 +189,7 @@ trait TestingAssetsTrait
|
||||
$this->resetJs();
|
||||
$this->setCssPipeline(false);
|
||||
$this->setJsPipeline(false);
|
||||
$this->order = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user