a2g_travel_blog/Classes/ViewHelpers/MapViewHelper.php

74 lines
2.5 KiB
PHP
Raw Normal View History

2023-12-04 16:40:27 +01:00
<?php
declare(strict_types = 1);
/*
* This file is part of the package t3g/blog.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
namespace A2G\A2gTravelBlog\ViewHelpers;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
use A2G\A2gMaps\Utility\MapConfigUtility;
class MapViewHelper extends AbstractTagBasedViewHelper
{
public function __construct()
{
$this->tagName = 'div';
parent::__construct();
}
/**
* Arguments Initialization.
*
* @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
*/
public function initializeArguments(): void
{
parent::initializeArguments();
$this->registerUniversalTagAttributes();
$this->registerArgument('category', 'int', 'categoryUid', true);
}
/**
* @return string the HTML <img>-Tag of the gravatar
*/
public function render(): string
{
// <div class="a2g-map"
// data-map-config='{"zoom":2,"maxZoom":18,
// "centerLon":0,"centerLat":0,
// "style": {
// "featureOverlay":{
// "stroke":{
// "color": "rgba(240,145,48,0.7)",
// "width": 4
// }
// }
// },
// "mapLayers":[{
// "layer": "country",
// "config": {
// "layer": "country",
// "countryGeoSource": "<f:uri.action action="activeCountriesGeojson" pluginName="MapConfig" controller="Map" extensionName="A2gTravelBlog" pageType="1652369512"></f:uri.action>"
// },
// "label": "country (free)",
// "active": true
// },{"layer":"osm","config":[],"label":"osm_map_layer","active":true}],
// "zoomSlider":true,
// "fullScreen":true}'></div>
//
/** @var GravatarProvider $gravatarProvider */
// $gravatarProvider = GeneralUtility::makeInstance(GravatarProvider::class);
// $src = $gravatarProvider->getAvatarUrl((new Author())->setEmail($this->arguments['email']));
$this->tag->addAttribute('data-map-config', '{}');
return $this->tag->render();
}
}