Skip to content

Commit

Permalink
Create es6 js module for location map wizard (#568)
Browse files Browse the repository at this point in the history
* Create es6 backend module for location map wizard; Update leaflet to v1.9.4 (also Maps Partial is affected!)

* Remove not needed use statements;

* Add leaflet v1.4.0 js/css for backwards compatibility; Delete unnecessary sourcemap path from leaflet 1.9.4 css; Rename leaflet 1.9.4 js/css files and images path; Enable map wizard under TYPO3 13

* Add linebreak to trigger PR
  • Loading branch information
mediaessenz authored Jul 31, 2024
1 parent a842b49 commit 202dc72
Show file tree
Hide file tree
Showing 14 changed files with 15,960 additions and 844 deletions.
14 changes: 4 additions & 10 deletions Classes/FormEngine/FieldControl/LocationMapWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Page\JavaScriptModuleInstruction;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* Adds a wizard for location selection via map
Expand Down Expand Up @@ -72,16 +71,11 @@ public function render(): array
$resultArray['linkAttributes']['data-namelat-active'] = htmlspecialchars($nameLatitudeActive);
$resultArray['linkAttributes']['data-tiles'] = htmlspecialchars('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
$resultArray['linkAttributes']['data-copy'] = '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
$resultArray['stylesheetFiles'][] = 'EXT:tt_address/Resources/Public/Contrib/leaflet-core-1.4.0.css';
$resultArray['stylesheetFiles'][] = 'EXT:tt_address/Resources/Public/Contrib/leaflet-1.9.4.css';
$resultArray['stylesheetFiles'][] = 'EXT:tt_address/Resources/Public/Backend/LocationMapWizard/leafletBackend.css';

$id = StringUtility::getUniqueId('t3js-formengine-fieldcontrol-');
$resultArray['requireJsModules'][] = JavaScriptModuleInstruction::forRequireJS(
'TYPO3/CMS/TtAddress/leaflet-core-1.4.0'
)->instance($id);
$resultArray['requireJsModules'][] = JavaScriptModuleInstruction::forRequireJS(
'TYPO3/CMS/TtAddress/LeafletBackend'
)->instance($id);
$pageRenderer = GeneralUtility::makeInstance('TYPO3\CMS\Core\Page\PageRenderer');
$pageRenderer->loadJavaScriptModule('@friendsoftypo3/tt-address/leaflet-backend.js');

return $resultArray;
}
Expand Down
4 changes: 2 additions & 2 deletions Configuration/TCA/tt_address.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,9 @@
'eval' => \FriendsOfTYPO3\TtAddress\Evaluation\LongitudeEvaluation::class,
'default' => null,
'fieldControl' => [
'locationMap' => ((new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() < 13) ? [
'locationMap' => [
'renderType' => 'locationMapWizard',
] : [],
],
],
'behaviour' => [
'allowLanguageSynchronization' => true,
Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Partials/Maps.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<f:render section="rendering" arguments="{_all}"/>

<f:asset.css identifier="ttaddress-leaflet" href="EXT:tt_address/Resources/Public/Contrib/leaflet-core-1.4.0.css" />
<f:asset.css identifier="ttaddress-leaflet" href="EXT:tt_address/Resources/Public/Contrib/leaflet-1.9.4.css" />
<f:asset.css identifier="ttaddress" href="EXT:tt_address/Resources/Public/Styles/basic.css" />
<f:asset.script identifier="ttaddress-leaflet-core" src="EXT:tt_address/Resources/Public/JavaScript/leaflet-core-1.4.0.js" />
<f:asset.script identifier="ttaddress-leaflet-core" src="EXT:tt_address/Resources/Public/JavaScript/leaflet-1.9.4.min.js" />
<f:asset.script identifier="ttaddress-leaflet" src="EXT:tt_address/Resources/Public/JavaScript/Frontend/Leaflet.js" />
</f:section>

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit 202dc72

Please sign in to comment.