From e574aa36a08fb65b63a4cb07c83a87afd47f1c22 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Wed, 5 Oct 2016 14:11:25 +0200 Subject: [PATCH] Add accidentally removed getLayer callback. --- .../Contao/Leaflet/Dca/LayerCallbacks.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Netzmacht/Contao/Leaflet/Dca/LayerCallbacks.php b/src/Netzmacht/Contao/Leaflet/Dca/LayerCallbacks.php index 9372bc7..bfee09a 100644 --- a/src/Netzmacht/Contao/Leaflet/Dca/LayerCallbacks.php +++ b/src/Netzmacht/Contao/Leaflet/Dca/LayerCallbacks.php @@ -329,6 +329,22 @@ class LayerCallbacks extends Callbacks return $options; } + /** + * Get all layers except of the current layer. + * + * @param \DataContainer $dataContainer The dataContainer driver. + * + * @return array + */ + public function getLayers($dataContainer) + { + $collection = LayerModel::findBy('id !', $dataContainer->id); + + return OptionsBuilder::fromCollection($collection, 'title') + ->asTree() + ->getOptions(); + } + /** * Generate a button. *