mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-02 04:53:56 +01:00
Add more controls.
This commit is contained in:
@@ -43,6 +43,11 @@ class DefinitionMapper
|
||||
*/
|
||||
private $mapId;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $mapped = array();
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
@@ -88,6 +93,12 @@ class DefinitionMapper
|
||||
*/
|
||||
public function handle(\Model $model, $elementId = null)
|
||||
{
|
||||
$hash = $model->getTable() . '.' . $model->{$model->getPk()};
|
||||
|
||||
if (isset($this->mapped[$hash])) {
|
||||
return $this->mapped[$hash];
|
||||
}
|
||||
|
||||
krsort($this->builders);
|
||||
|
||||
$this->mapId = $elementId ?: ($model->alias ?: ('map_' . $model->id));
|
||||
@@ -100,6 +111,8 @@ class DefinitionMapper
|
||||
$event = new BuildDefinitionEvent($definition, $model);
|
||||
$this->eventDispatcher->dispatch($event::NAME, $event);
|
||||
|
||||
$this->mapped[$hash] = $definition;
|
||||
|
||||
return $definition;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user