Renders the Google map.

@param array $PA
@param \TYPO3\CMS\Backend\Form\Element\UserElement $pObj
@return string
@throws \Exception
967555
public function render(array &$PA, $pObj)
    {
        $pluginSettings = static::getSettings();

        $googleMapsLibrary = $pluginSettings['googleMapsLibrary'] ?? ' //maps.google.com/maps/api/js?v=weekly';

        if ($pluginSettings['apiKey']) {
            $googleMapsLibrary .= '&key=' . $pluginSettings['apiKey'];
        }

        $out = [];
        $latitude = (float)$PA['row'][$PA['parameters']['latitude']];
        $longitude = (float)$PA['row'][$PA['parameters']['longitude']];
        $address = $PA['row'][$PA['parameters']['address']];

        $baseElementId = isset($PA['itemFormElID']) ? $PA['itemFormElID'] : $PA['table'] . '_map';
        $addressId = $baseElementId . '_address';
        $mapId = $baseElementId . '_map';

        if (!($latitude && $longitude)) {
            $latitude = 0;
            $longitude = 0;
        }
        $dataPrefix = 'data[' . $PA['table'] . '][' . $PA['row']['uid'] . ']';
        $latitudeField = $dataPrefix . '[' . $PA['parameters']['latitude'] . ']';
        $longitudeField = $dataPrefix . '[' . $PA['parameters']['longitude'] . ']';
        $addressField = $dataPrefix . '[' . $PA['parameters']['address'] . ']';
        $streetFieldName = $dataPrefix . '[' . $PA['parameters']['street'] . ']';
        $zipFieldName = $dataPrefix . '[' . $PA['parameters']['zip'] . ']';
        $cityFieldName = $dataPrefix . '[' . $PA['parameters']['city'] . ']';

        $updateJs = "TBE_EDITOR.fieldChanged('%s','%s','%s','%s');";
        $updateLatitudeJs = sprintf(
            $updateJs,
            $PA['table'],
            $PA['row']['uid'],
            $PA['parameters']['latitude'],
            $latitudeField
        );
        $updateLongitudeJs = sprintf(
            $updateJs,
            $PA['table'],
            $PA['row']['uid'],
            $PA['parameters']['longitude'],
            $longitudeField
        );
        $updateAddressJs = sprintf(
            $updateJs,
            $PA['table'],
            $PA['row']['uid'],
            $PA['parameters']['address'],
            $addressField
        );


        $out[] = '<script type="text/javascript" src="' . $googleMapsLibrary . '"></script>';
        $out[] = '<script type="text/javascript">';
        $out[] = <<<EOT
if (typeof TxClimbingSites == 'undefined') TxClimbingSites = {};

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); } 

TxClimbingSites.init = function() {
	TxClimbingSites.origin = new google.maps.LatLng({$latitude}, {$longitude});
	var myOptions = {
		zoom: 12,
		center: TxClimbingSites.origin,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	
	if(document.getElementsByName("{$streetFieldName}")[0] && 
	    document.getElementsByName("{$streetFieldName}")[0] && 
	    document.getElementsByName("{$streetFieldName}")[0]) {
	    var button = document.getElementById('gme-btn-address').style.display = 'inline-block';
	}
	
	TxClimbingSites.map = new google.maps.Map(document.getElementById("{$mapId}"), myOptions);
	TxClimbingSites.marker = new google.maps.Marker({
		map: TxClimbingSites.map,
		position: TxClimbingSites.origin,
		draggable: true
	});
	google.maps.event.addListener(TxClimbingSites.marker, 'dragend', function() {
		var lat = TxClimbingSites.marker.getPosition().lat().toFixed(6);
		var lng = TxClimbingSites.marker.getPosition().lng().toFixed(6);

        // update fields
		TxClimbingSites.updateValue('{$latitudeField}', lat);
        TxClimbingSites.updateValue('{$longitudeField}', lng);

		// Update address
		TxClimbingSites.reverseGeocode(TxClimbingSites.marker.getPosition().lat(), TxClimbingSites.marker.getPosition().lng());

		// Update Position
		var position = document.getElementById("{$addressId}");
		position.value = lat + "," + lng;

		// Tell TYPO3 that fields were updated
		TxClimbingSites.positionChanged();
	});
	TxClimbingSites.geocoder = new google.maps.Geocoder();

};

TxClimbingSites.refreshMap = function() {
	google.maps.event.trigger(TxClimbingSites.map, 'resize');
	TxClimbingSites.map.setCenter(TxClimbingSites.marker.getPosition());
	// No need to do it again
	Ext.fly(TxClimbingSites.tabPrefix + '-MENU').un('click', TxClimbingSites.refreshMap);
}

TxClimbingSites.localize = function(address) {
    TxClimbingSites.geocoder.geocode({'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            // Get Position
            lat = results[0].geometry.location.lat().toFixed(6);
            lng = results[0].geometry.location.lng().toFixed(6);

            formatedAddress = results[0].formatted_address

            // Update Map
            TxClimbingSites.map.setCenter(results[0].geometry.location);
            TxClimbingSites.marker.setPosition(results[0].geometry.location);

            // Update fields
            TxClimbingSites.updateValue('{$latitudeField}', lat);
            TxClimbingSites.updateValue('{$longitudeField}', lng);
            TxClimbingSites.updateValue('{$addressField}', formatedAddress);

            TxClimbingSites.positionChanged();
        } else {
            alert("Geocode was not successful for the following reason: " + status);
        }
    });
}

/***************************/
TxClimbingSites.codeAddress = function() {
	var address = document.getElementById("{$addressId}").value;
	var lat = 0;
	var lng = 0;
	if(address.match(/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/)) {
		// Get Position
		lat = address.substr(0, address.lastIndexOf(',')).trim();
		lng = address.substr(address.lastIndexOf(',')+1).trim();
		position = new google.maps.LatLng(lat, lng);

		// Update Map
		TxClimbingSites.map.setCenter(position);
		TxClimbingSites.marker.setPosition(position);

		// Update visible fields
		TxClimbingSites.updateValue('{$latitudeField}', lat);
        TxClimbingSites.updateValue('{$longitudeField}', lng);

		// Get Address
		TxClimbingSites.reverseGeocode(lat, lng);
	} else {
		TxClimbingSites.localize(address);
	}
}

TxClimbingSites.codeByAddress = function() {
	var street = document.getElementsByName("{$streetFieldName}")[0].value,
	    zip = document.getElementsByName("{$zipFieldName}")[0].value,
	    city = document.getElementsByName("{$cityFieldName}")[0].value,
	    address = street + ',' + zip + ' ' + city;
	    	
    TxClimbingSites.localize(address);
}

TxClimbingSites.positionChanged = function() {
    {$updateLatitudeJs}
    {$updateLongitudeJs}
    {$updateAddressJs}
    TYPO3.FormEngine.Validation.validate();
}

TxClimbingSites.updateValue = function(fieldName, value) {
    document[TBE_EDITOR.formname][fieldName].value = value;
    window.$('[data-formengine-input-name="' + fieldName + '"]').val(value);
}

TxClimbingSites.setMarker = function(lat, lng) {
	var addressInput = document.getElementById("{$addressId}");
	var latlng = new google.maps.LatLng(lat, lng);
	TxClimbingSites.geocoder.geocode({'latLng': latlng}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
			TxClimbingSites.map.setCenter(results[0].geometry.location);
			TxClimbingSites.marker.setPosition(results[0].geometry.location);
		} else {
			alert("Geocode was not successful for the following reason: " + status);
		}
	});
}

TxClimbingSites.reverseGeocode = function(latitude, longitude) {
	var latlng = new google.maps.LatLng(latitude, longitude);
	TxClimbingSites.geocoder.geocode({'latLng': latlng}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK && results[1]) {
		    TxClimbingSites.updateValue('{$addressField}', results[1].formatted_address);
			TxClimbingSites.positionChanged();
		}
	});
}

TxClimbingSites.convertAddress = function(addressOld) {
	addressInput = document.getElementById("{$addressId}");

	TxClimbingSites.geocoder.geocode({'address':addressOld}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
			TxClimbingSites.map.setCenter(results[0].geometry.location);
			TxClimbingSites.marker.setPosition(results[0].geometry.location);
			var lat = TxClimbingSites.marker.getPosition().lat().toFixed(6);
			var lng = TxClimbingSites.marker.getPosition().lng().toFixed(6);

            TxClimbingSites.updateValue('{$latitudeField}', lat);
            TxClimbingSites.updateValue('{$longitudeField}', lng);

			// Update visible fields
			addressInput.value = addressOld;
		} else {
			alert("Geocode was not successful for the following reason: " + status);
		}
	});
}

window.onload = TxClimbingSites.init;
EOT;
        $out[] = '</script>';
        $out[] = '<div id="' . $baseElementId . '">';
        $out[] = '
			<input type="text" 
			       class="form-control" 
			       value="' . $address . '" 
			       id="' . $addressId . '" 
			       style="display:inline-block;width:300px">
			<input type="button" 
			       value="' . LocalizationUtility::translate('update_by_position', 'go_maps_ext') . '" 
			       class="btn btn-sm btn-default"
			       onclick="TxClimbingSites.codeAddress()">
			<input id="gme-btn-address"
			       type="button" 
			       value="' . LocalizationUtility::translate('update_by_address', 'go_maps_ext') . '" 
			       class="btn btn-sm btn-default"
			       style="display:none;"
			       onclick="TxClimbingSites.codeByAddress()">
		';
        $out[] = '<div id="' . $mapId . '" style="height:400px;margin:10px 0;width:400px"></div>';
        $out[] = '</div>'; // id=$baseElementId

        return implode('', $out);
    }
961428
public function render(InfoWindow $infoWindow, Map $map, Marker $marker = null)
    {
        $arguments = [$map->getVariable()];

        if ($marker !== null) {
            $arguments[] = $marker->getVariable();
        }

        return $this->getFormatter()->renderObjectCall($infoWindow, 'open', $arguments);
    }
983817
public function render(Map $map)
    {
        return $this->renderHtml($map).$this->renderStylesheet($map).$this->renderJavascript($map);
    }
326742
public function renderAfterSuite($obj)
    {
        $print = array();
        foreach ($this->rendererList as $name => $renderer) {
            $print[$name] = $renderer->renderAfterSuite($obj);
        }

        return $print;
    }
171699
public function render(array $arguments = [], $renderer = null) {
        if(!$this->getMeta()->editable) {
            throw new Exception('Field "' . $this->getMeta()->name . '" is not editable');
        }

        $type = $this->getMeta()->type;
        if($renderer === null) {
            if(!isset(static::$renderers[$type])) {
                if(static::$fallbackRenderer === null) {
                    throw new Exception('No Default Renderer Exists for Class "' . get_class() . '"');
                }
                $renderer = static::$fallbackRenderer;
            } else {
                if(is_callable(static::$renderers[$type])) {
                    $callable = static::$renderers[$type];
                    static::$renderers[$type] = $callable();
                }
                $renderer = static::$renderers[$type];
            }
        } else {
            if(is_callable($renderer)) {
                $renderer = $renderer();
            }
        }

        return $renderer->render($this, $arguments);
    }
11899
public function renderBeforeStep($obj)
    {
        $print = array();
        foreach ($this->rendererList as $name => $renderer) {
            $print[$name] = $renderer->renderBeforeStep($obj);
        }

        return $print;
    }
349475
public function render(array $parameters = []): string
    {
        /** @var Location $location */
        $location = $parameters['location'];
        /** @var Content $content */
        $content = $parameters['content'];
        /** @var Language $language */
        $language = $parameters['language'];
        $versionNo = $content->getVersionInfo()->versionNo;

        // nonpublished content should use parent location instead because location doesn't exist yet
        if (!$content->contentInfo->published && null === $content->contentInfo->mainLocationId) {
            $parentLocations = $this->locationService->loadParentLocationsForDraftContent($content->getVersionInfo());
            $location = reset($parentLocations);
            $versionNo = null;
        }

        $siteaccesses = $this->siteaccessResolver->getSiteaccessesForLocation(
            $location,
            $versionNo,
            $language->languageCode
        );

        if (empty($siteaccesses)) {
            return $this->twig->render(
                '@ezdesign/content/content_edit/component/preview_unavailable.html.twig'
            );
        }

        return '';
    }
600173
public function invoke(Interfaces\JavaType $javaObject = null, string $method, array $args = [])
    {
        try {
            return $this->pjbProxyClient->invokeMethod($javaObject, $method, $args);
        } catch (Pjb62BrokenConnectionException | Exception\InvalidUsageException $e) {
            PjbProxyClient::unregisterInstance();
            throw new BrokenConnectionException($e->getMessage(), $e->getCode(), $e);
        }
    }
656230
public function renderCall($method, array $arguments = [], $semicolon = false, $newLine = false)
    {
        return $this->renderCode(
            $method.$this->renderArguments($arguments),
            $semicolon,
            $newLine
        );
    }
176133
public function render(GeoJsonLayer $geoJsonLayer, Map $map)
    {
        $formatter = $this->getFormatter();
        $jsonBuilder = $this->getJsonBuilder()->setValues($geoJsonLayer->getOptions());

        return $formatter->renderObjectCall($map, $formatter->renderProperty('data', 'loadGeoJson'), [
            $formatter->renderEscape($geoJsonLayer->getUrl()),
            $jsonBuilder->build(),
        ]);
    }
1356972
public function addConfigEvent(&$params, &$pObj)
    {
        $aID = $params['flexParentDatabaseRow']['pi_flexform']['data']['General']['lDEF']['settings.associationID']['vDEF'];

        if (!empty($aID)) {
            $associationRepository = $this->objectManager->get(AssociationRepository::class);
            $eventRepository = $this->objectManager->get(EventRepository::class);

            $association = $associationRepository->findByID($aID);

            $events = $eventRepository->findEventsByAssociation($association);

            foreach ($events->getEvents() as $event) {
                $params['items'][] = [
          implode(' - ', [$event->getStartDate()->format('d.m.Y H:i:s'), $event->getTitle()]),
          $event->getID()
        ];
            }
        }
    }
711443
public function renderObjectCall(
        VariableAwareInterface $object,
        $method,
        array $arguments = [],
        $semicolon = false,
        $newLine = false
    ) {
        return $this->renderCall(
            $this->renderProperty($object->getVariable(), $method),
            $arguments,
            $semicolon,
            $newLine
        );
    }
1072742
protected function createGetAllAppsResponse(GetAllAppsRequest $request, Pbjx $pbjx): GetAllAppsResponse
    {
        /** @var GetAllAppsResponse $response */
        $response = $this->createResponseFromRequest($request, $pbjx);
        return $response;
    }
8675
public function addConfigFunctionary(&$params, &$pObj)
    {
        $aID = $params['flexParentDatabaseRow']['pi_flexform']['data']['General']['lDEF']['settings.associationID']['vDEF'];

        if (!empty($aID)) {
            $associationRepository = $this->objectManager->get(AssociationRepository::class);
            $functionaryRepository = $this->objectManager->get(FunctionaryRepository::class);

            $association = $associationRepository->findByID($params['flexParentDatabaseRow']['pi_flexform']['data']['General']['lDEF']['settings.associationID']['vDEF']);

            $functionaries = $functionaryRepository->findFunctionariesByAssociation($association);

            foreach ($functionaries->getfunctionaries() as $functionary) {
                $params['items'][] = [
          implode(' | ', [implode(' ', [$functionary->getLastName(), $functionary->getFirstName()]), $functionary->getRole()]),
          $functionary->getID()
        ];
            }
        }
    }
205730
public function render($options = array()) {
        $options = array_merge($this->_defaults, $options);
        $markers = $this->getMarkersAsString($options);
        $img = '';

        $img .= '<img src="http://maps.google.com/maps/api/staticmap';
        $img .= '?center=' . $options['location']['lat'] . ',' . $options['location']['lng'];
        $img .= '&amp;zoom=' . $options['zoomLevel'];
        $img .= '&amp;size=' . $options['width'] . 'x' . $options['height'];
        $img .= '&amp;maptype=' . $options['mapType'];
        $img .= ($markers ? '&amp;markers=' . $markers : '');
        $img .= '&amp;sensor=' . ($options['sensor'] ? 'true' : 'false') . '" ';
        $img .= 'width="' . $options['width'] . '" height="' . $options['height'] . '" alt="';
        $img .= $options['altText'] . '" class="g-googlemap" />';

        $this->view->script()->src(
            'https://www.google.com/maps/api/js?sensor=' . ($options['sensor'] ? 'true' : 'false')
        );
        return $img;
    }
630529
public function renderBeforeOutline($obj)
    {
        //scenario head
        $print = '
            <div class="scenario">
                <ul class="tags">';
        foreach ($obj->getCurrentScenario()->getTags() as $tag) {
            $print .= '
                    <li>@'.$tag.'</li>';
        }
        $print .= '
                </ul>';

        $print .= '
                <h3>
                    <span class="keyword">'.$obj->getCurrentScenario()->getId().' Scenario Outline: </span>
                    <span class="title">'.$obj->getCurrentScenario()->getName().'</span>
                </h3>
                <ol>';

        //TODO path is missing

        return $print;
    }
194785
function getPolygonJS() {
        $_output = '';
        foreach($this->_polygons as $polygon_id => $_polygon) {
        	$_coords_output = "";
        	foreach($_polygon["coords"] as $_coords){
				if($_coords_output != ""){$_coords_output.=",";}
        		$_coords_output .= "
        		    new google.maps.LatLng(".$_coords["lat"].", ".$_coords["long"].")
        		";
        	}
        	$_output .= "
        	   polygonCoords".$this->map_id."[$polygon_id] = [".$_coords_output."];    	
			   polygon".$this->map_id."[$polygon_id] = new google.maps.Polygon({
				  paths: polygonCoords".$this->map_id."[$polygon_id]
				  ".(($_polygon['color']!="")?", strokeColor: '".$_polygon['color']."'":"")."
				  ".(($_polygon['opacity']!=0)?", strokeOpacity: ".$_polygon['opacity']."":"")."
				  ".(($_polygon['weight']!=0)?", strokeWeight: ".$_polygon['weight']."":"")."
				  ".(($_polygon['fill_color']!="")?", fillColor: '".$_polygon['fill_color']."'":"")."
				  ".(($_polygon['fill_opacity']!=0)?", fillOpacity: ".$_polygon['fill_opacity']."":"")."
			  });			
			  polygon".$this->map_id."[$polygon_id].setMap(map".$this->map_id.");
        	";
		}
        return $_output;
    }