Danke Spooky,
aber da es ein ziemlich volles Kauftemplate ist, habe ich mit Trial and Error mich an die Stelle vorgewagt und naturgemäß funktioniert es erst mal nicht.
Hier mein Frankenstein mit Deinen Vorschlägen im gesamten Template:
Code:
<div class="info-map <?php echo $this->class ?>"<?php echo $this->cssID ?>>
<div class="info-map-gmap <?php if ($this->deactivateHover): ?> -no-hover<?php endif ?>"></div>
<?php
$objEvent = \CalendarEventsModel::findByAlias(\Input::get('auto_item'));
if (null === $objEvent || !$objEvent->location)
{
return;
}
?>
<script>
(function() {
var mapElement = document.querySelectorAll && document.querySelectorAll('.info-map-gmap');
if (!mapElement || !mapElement.length) {
return;
}
mapElement = mapElement[mapElement.length - 1];
window.rsce_tao_info_map_queue = window.rsce_tao_info_map_queue || [];
window.rsce_tao_info_map_queue.push(function() {
var style = [
{hue: '#1fa5d1'},
{saturation: -80},
{lightness: 10},
{gamma: 0.8}
];
var map = new google.maps.Map(mapElement, {
zoom: <?php echo json_encode($this->zoomLevel * 1) ?>,
scrollwheel: false,
mapTypeControl: false,
scaleControl: false,
overviewMapControl: false,
panControl: false,
rotateControl: false,
streetViewControl: false,
zoomControl: false,
styles: [
{featureType: 'landscape', stylers: style},
{featureType: 'road.highway', stylers: style},
{featureType: 'road.arterial', stylers: style},
{featureType: 'road.local', stylers: style},
{featureType: 'water', stylers: style},
{featureType: 'poi', stylers: style}
]
});
var geocoder = new google.maps.Geocoder();
geocoder.geocode(
{address: <?php echo $objEvent->location ?>},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
}
}
);
});
window.rsce_tao_info_map_init = function () {
for (var i = 0; i < window.rsce_tao_info_map_queue.length; i++) {
window.rsce_tao_info_map_queue[i]();
}
};
if (!document.getElementById('rsce_tao_info_map_script')) {
var scripts = document.getElementsByTagName('script');
var script = document.createElement('script');
script.id = 'rsce_tao_info_map_script';
script.type = 'text/javascript';
script.async = true;
script.src = '//maps.googleapis.com/maps/api/js?key=<?php echo $this->apiKey ?>&sensor=false&callback=rsce_tao_info_map_init';
scripts[0].parentNode.insertBefore(script, scripts[0]);
}
})();
</script>
<div class="info-map-boxes">
<?php foreach ($this->boxes as $index => $box): ?>
<?php $className = 'info-map-boxes-item ' . $this->getColumnClassName($index) ?>
<?php if ($box->url): ?>
<a class="<?php echo $className ?>" href="<?php echo $box->url ?>"<?php if ($box->icon): ?> data-icon="&#x<?php echo $box->icon ?>;"<?php endif ?><?php if ($box->newWindow): ?> target="_blank"<?php endif ?>><section>
<?php else: ?>
<section class="<?php echo $className ?>"<?php if ($box->icon): ?> data-icon="&#x<?php echo $box->icon ?>;"<?php endif ?>>
<?php endif ?>
<?php if ($box->headline): ?>
<h3><?php echo $box->headline ?></h3>
<?php endif ?>
<?php if ($box->text): ?>
<?php echo $box->text ?>
<?php endif ?>
<?php if ($box->linkLabel): ?>
<p class="info-map-boxes-item-link"><?php echo $box->linkLabel ?></p>
<?php endif ?>
<?php if ($box->url): ?>
</section></a>
<?php else: ?>
</section>
<?php endif ?>
<?php endforeach ?>
</div>
</div>
Ich bin aber noch auf eine andere Stelle gestoßen, an der man tätig werden könnte, nämlich das Script, was die Eingabe im Backend offenbar generiert. Auch hier wird die Textfeldeingabe für eine Adresse aufgebaut, vielleicht kann man hier schon ansetzen. Auszug:
Code:
return array(
'label' => array(
'Google Map mit Textboxen',
'Erzeugt eine vollflächige Google Map mit Textboxen',
),
'types' => array('content', 'module'),
'standardFields' => array('cssID', 'columns'),
'fields' => array(
'mapAddress' => array(
'label' => array('Adresse oder Koordinaten der GoogleMap', 'z.B.: "Berlin, Deutschland" oder "Spandauer Straße 1, Berlin, Deutschland"'),
'inputType' => 'text',
'eval' => array('tl_class' => 'w50'),
),
Dennoch bleibe ich eher als Hobbybastler hier ratlos stehen. Wie gesagt, die Karte ist in meinem Projekt kein Muss, sondern nur eine Idee.
Lesezeichen