[ticket/13961] Allow the collection to be modified runtime

PHPBB3-13961
This commit is contained in:
Mate Bartus 2015-06-27 12:49:10 +02:00
parent b09293d5ff
commit c80cf87b90

View file

@ -90,14 +90,9 @@ class ordered_service_collection extends service_collection
*/ */
public function add($service_id, $order = 0) public function add($service_id, $order = 0)
{ {
if ($this->is_ordered)
{
return;
}
$order = (int) $order; $order = (int) $order;
$this->service_ids[$order][] = $service_id; $this->service_ids[$order][] = $service_id;
$this->is_ordered = false;
} }
protected function sort_services() protected function sort_services()
@ -107,6 +102,7 @@ class ordered_service_collection extends service_collection
return; return;
} }
$this->exchangeArray(array());
ksort($this->service_ids); ksort($this->service_ids);
foreach ($this->service_ids as $service_order_group) foreach ($this->service_ids as $service_order_group)
{ {