forked from Snck3rs/contao-leaflet-maps
Implement boundsMode fit.
This commit is contained in:
@@ -302,6 +302,30 @@ class Layer
|
||||
->execute($dataContainer->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bounds modes supported by the layer.
|
||||
*
|
||||
* @param \DataContainer $dataContainer The data container.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBoundsModes($dataContainer)
|
||||
{
|
||||
$options = array();
|
||||
|
||||
if ($dataContainer->activeRecord && !empty($this->layers[$dataContainer->activeRecord->type]['boundsMode'])) {
|
||||
foreach ($this->layers[$dataContainer->activeRecord->type]['boundsMode'] as $mode => $enabled) {
|
||||
if ($enabled === true) {
|
||||
$options[] = $mode;
|
||||
} elseif ($enabled === 'deferred' && $dataContainer->activeRecord->deferred) {
|
||||
$options[] = $mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a button.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user