mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-02 13:03:43 +01:00
Fix handling of inactive layers.
This commit is contained in:
@@ -27,4 +27,17 @@ class ControlModel extends AbstractActiveModel
|
||||
|
||||
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Model\Collection
|
||||
*/
|
||||
public function findActiveLayers()
|
||||
{
|
||||
$query = 'SELECT l.*, c.mode as controlMode FROM tl_leaflet_layer l LEFT JOIN tl_leaflet_control_layer c ON l.id = c.lid WHERE c.cid=? AND l.active=1';
|
||||
$result = \Database::getInstance()
|
||||
->prepare($query)
|
||||
->execute($this->id);
|
||||
|
||||
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,17 @@ class MapModel extends \Model
|
||||
|
||||
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Model\Collection
|
||||
*/
|
||||
public function findActiveLayers()
|
||||
{
|
||||
$query = 'SELECT l.* FROM tl_leaflet_layer l LEFT JOIN tl_leaflet_map_layer m ON l.id = m.lid WHERE m.mid=? AND l.active=1';
|
||||
$result = \Database::getInstance()
|
||||
->prepare($query)
|
||||
->execute($this->id);
|
||||
|
||||
return \Model\Collection::createFromDbResult($result, 'tl_leaflet_layer');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user