From 685c9ae1d4c21bfec0be9fbaa5b0ae4155251ce4 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Thu, 8 Jan 2015 15:29:07 +0100 Subject: [PATCH] Add marker sorting --- module/dca/tl_leaflet_marker.php | 6 +++++- .../Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/module/dca/tl_leaflet_marker.php b/module/dca/tl_leaflet_marker.php index c46373a..8f26502 100644 --- a/module/dca/tl_leaflet_marker.php +++ b/module/dca/tl_leaflet_marker.php @@ -23,7 +23,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array 'sorting' => array ( 'mode' => 4, - 'fields' => array('title'), + 'fields' => array('sorting'), 'flag' => 1, 'headerFields' => array('title', 'type'), 'child_record_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'generateRow'), @@ -123,6 +123,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array ( 'sql' => "int(10) unsigned NOT NULL default '0'" ), + 'sorting' => array + ( + 'sql' => "int(10) unsigned NOT NULL default '0'" + ), 'pid' => array ( 'sql' => "int(10) unsigned NOT NULL default '0'" diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php index 13e850e..27a244b 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php @@ -107,7 +107,8 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper { $collection = MarkerModel::findBy( array('active=1', 'pid=?'), - array($model->id) + array($model->id), + array('order' => 'sorting') ); return $collection;