-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Just a suggestion, but it would be great to have the ability to manually set each Tracks order, rather than only having the option of array index.
For example, I've found I need to add layers out of order, so I've had to create a middleware that allows me to re-order the Tracks before committing them to the SDK.
If Track had an order attribute and setter available, which fell-back/defaulted to the upstream Timeline array priority that would be incredible.
eg:
<?php
namespace Shotstack\Client\Model;
class Track implements ModelInterface, ArrayAccess
{
//...
public function setOrder(int $order)
{
$this->container['order'] = $order;
return $this;
}
public function getOrder()
{
return $this->container['order'] ?? null;
}
}<?php
namespace Shotstack\Client\Model;
class Timeline implements ModelInterface, ArrayAccess
{
//...
public function getTracks()
{
$originalTracks = $this->container['tracks'];
$orderedTracks = [];
$tracks = [];
foreach($originalTracks as $track) {
if($track->getOrder()) {
$orderedTracks[] = $track;
} else {
$tracks[] = $track;
}
}
// I'm using a third-party library here to pull all the ...
array_unshift($orderedTracks, $tracks);
return $tracks;
}
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request