diff --git a/src/Netzmacht/Contao/Leaflet/Dca/ControlCallbacks.php b/src/Netzmacht/Contao/Leaflet/Dca/ControlCallbacks.php index 34acbd7..a4c52cf 100644 --- a/src/Netzmacht/Contao/Leaflet/Dca/ControlCallbacks.php +++ b/src/Netzmacht/Contao/Leaflet/Dca/ControlCallbacks.php @@ -81,16 +81,11 @@ class ControlCallbacks extends Callbacks */ public function getLayers() { - $options = array(); - $collection = LayerModel::findBy('pid', '0', array('order' => 'title')); + $collection = LayerModel::findAll(); - if ($collection) { - foreach ($collection as $model) { - $options[$model->id] = $model->title; - } - } - - return $options; + return OptionsBuilder::fromCollection($collection, 'title') + ->asTree() + ->getOptions(); } /**