Compare commits

..

55 Commits

Author SHA1 Message Date
dependabot[bot]
d5c7a44c07 Bump minimatch from 3.0.4 to 3.1.2
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-20 09:45:36 +00:00
David Molineus
06400f9d1a Merge branch 'support-mm-2-3' 2023-02-20 10:37:20 +01:00
David Molineus
b346efeb0a Update phpcq tools 2023-02-20 10:36:01 +01:00
David Molineus
dd23a1594e Fix coding standard violations 2023-02-20 10:35:00 +01:00
David Molineus
ae800257d8 Do not silence warnings with @ 2023-02-20 10:28:21 +01:00
David Molineus
35e86ec1b9 Remove dependency of doctrine/cache 2023-02-20 09:58:43 +01:00
David Molineus
a2d1ae683d Load after leaflet-libs (See #120) 2023-02-20 09:11:07 +01:00
Stefan Heimes
91ba3ebf04 Correct a misspelled variable name 2023-01-11 12:15:30 +01:00
Stefan Heimes
8ab3cf286c Change the required minimum version of "doctrine/cache"
Remove the version 1.0 'cause of API changes.
2023-01-11 12:10:57 +01:00
Stefan Heimes
ec30f4b4b9 Correct PHP doc and add missing author 2023-01-11 12:10:18 +01:00
Stefan Heimes
fd54d739d7 Code styling 2023-01-11 12:09:58 +01:00
Sven Baumann
44546e4952 Added missing evaluation flags, for save not encoded json in the database 2022-12-10 11:18:57 +01:00
Sven Baumann
9814ed31ad Suppress warnings for undefined array key 2022-12-08 20:02:46 +01:00
Sven Baumann
bfa70d9f21 Fixed issue for deprecated missing return type 2022-12-08 19:40:02 +01:00
Sven Baumann
ff6aae3a6e Allow symfony/templating ^6.2 2022-12-08 19:26:54 +01:00
Stefan Heimes
c4980c481d Update for PHP 8.1 and MetaModels 2.3 2022-11-25 17:53:28 +01:00
Stefan Heimes
d0b9e7cf10 Update for metamodels
- MetaModels need doctrine/cache in the version ^2.1
2022-11-16 16:56:46 +01:00
David Molineus
097cd5c31f Merge pull request #113 from netzmacht/dependabot/npm_and_yarn/copy-props-2.0.5
Bump copy-props from 2.0.4 to 2.0.5
2022-02-22 10:52:33 +01:00
dependabot[bot]
c01610271c Bump copy-props from 2.0.4 to 2.0.5
Bumps [copy-props](https://github.com/gulpjs/copy-props) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/gulpjs/copy-props/releases)
- [Changelog](https://github.com/gulpjs/copy-props/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/copy-props/compare/2.0.4...2.0.5)

---
updated-dependencies:
- dependency-name: copy-props
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-22 09:49:57 +00:00
David Molineus
bcb68af234 Merge tag '3.2.3' 2022-02-22 10:49:14 +01:00
David Molineus
0e491fcc6a Prepare release 3.2.3 2022-02-22 10:47:32 +01:00
David Molineus
ea293e327f Fix access of sub layers (#97) 2022-02-22 10:30:08 +01:00
David Molineus
18f1cb5756 Load language file for the help wizard (#99) 2022-02-22 10:11:41 +01:00
David Molineus
e38e926891 Avoid array index warning 2022-02-22 10:10:57 +01:00
David Molineus
700a87bd1f Drop leftover phpcq v1 files 2022-02-22 09:53:52 +01:00
David Molineus
94ecdf9d42 Show group icon (#101) 2022-02-22 09:53:41 +01:00
David Molineus
9434302a16 Use symfony translation contracts 2022-02-22 09:52:12 +01:00
David Molineus
b79a75ac21 Update supported providers 2022-02-22 08:42:54 +01:00
David Molineus
d498903645 Fix overlapping of fields (#107) 2022-02-22 08:33:50 +01:00
David Molineus
c544202ca8 Fix applying bounds to a tile layer (Closes #109) 2022-02-22 08:30:32 +01:00
David Molineus
93f176a738 Silence info of contao/components-installer 2022-02-21 20:15:45 +01:00
David Molineus
852b926252 Support doctrine/dbal 3 2022-02-21 20:11:56 +01:00
David Molineus
87bd720d6e Switch to phpcq dev-2.0 2022-02-21 17:13:53 +01:00
David Molineus
3f2020b0d1 Do not test against PHP 8.0. The toolchain is not ready for it :-( 2022-02-21 16:51:49 +01:00
David Molineus
e9b0d6156f Merge pull request #100 from netzmacht/dependabot/npm_and_yarn/y18n-3.2.2
Bump y18n from 3.2.1 to 3.2.2
2022-02-21 16:43:42 +01:00
David Molineus
e8f1fa2485 Merge pull request #103 from netzmacht/dependabot/npm_and_yarn/hosted-git-info-2.8.9
Bump hosted-git-info from 2.8.8 to 2.8.9
2022-02-21 16:43:15 +01:00
David Molineus
791eebaddb Merge pull request #106 from netzmacht/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2022-02-21 16:42:55 +01:00
David Molineus
2ed1000d4d Drop .travis.yml 2022-02-21 16:41:24 +01:00
David Molineus
4e52e31937 Add diagnostics 2022-02-21 16:40:33 +01:00
David Molineus
ef8b6d294d Require latest version of contao-toolkit 2022-02-21 16:37:54 +01:00
David Molineus
445729acfe Do not use templating engine where not required 2022-02-21 16:36:43 +01:00
David Molineus
d6a7e14a05 Bump requirements and fix symfony/event-dispatcher usage 2022-02-21 16:31:52 +01:00
dependabot[bot]
bd0eb5a416 Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-10 20:25:42 +00:00
dependabot[bot]
664ce11831 Bump hosted-git-info from 2.8.8 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-09 18:49:21 +00:00
dependabot[bot]
8a752b1955 Bump y18n from 3.2.1 to 3.2.2
Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-30 15:31:51 +00:00
David Molineus
f2584d400c Update changelog 2020-12-18 09:48:41 +01:00
David Molineus
60e285c673 Generate absolute urls for file layers
https://github.com/netzmacht/contao-leaflet-maps/issues/92
2020-12-18 09:13:29 +01:00
David Molineus
49f3b7dbcd Remove template debug placeholders (#93) 2020-12-18 08:55:28 +01:00
David Molineus
89d83ab8e0 Merge pull request #95 from netzmacht/dependabot/npm_and_yarn/ini-1.3.7
Bump ini from 1.3.5 to 1.3.7
2020-12-18 08:55:15 +01:00
dependabot[bot]
141bb0f7b1 Bump ini from 1.3.5 to 1.3.7
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-10 23:52:13 +00:00
David Molineus
457bb612ef Update changelog 2020-09-02 07:42:33 +02:00
David Molineus
118bb9a829 Do not append javascript at the body but inject them in the element/module
Consent tools might interrupt the rendering
2020-09-02 07:40:44 +02:00
David Molineus
e49c74c546 Merge tag '3.2.0' into master 2020-08-28 17:19:23 +02:00
David Molineus
6054def7aa Prepare release 2020-08-28 17:19:04 +02:00
David Molineus
86026a473b Add support for hofff/contao-consent-bridge #81 2020-08-28 17:14:33 +02:00
64 changed files with 575 additions and 271 deletions

View File

@@ -6,6 +6,10 @@
"array_insert",
"Contao\\ManagerPlugin\\Bundle\\BundlePluginInterface",
"Contao\\ManagerPlugin\\Bundle\\Config\\BundleConfig",
"Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface"
"Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface",
"Contao\\ManagerPlugin\\Routing\\RoutingPluginInterface",
"Hofff\\Contao\\Consent\\Bridge\\Bridge",
"Hofff\\Contao\\Consent\\Bridge\\Plugin",
"Hofff\\Contao\\Consent\\Bridge\\Render\\RenderInformation"
]
}

82
.github/workflows/diagnostics.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
name: Code Quality Diagnostics
on:
pull_request:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
name: PHP ${{ matrix.php }}
strategy:
fail-fast: false
matrix:
include:
- php: 7.4
output: '-o github-action -o default'
phpcq_install: 'install'
- php: 8.0
output: '-o default'
phpcq_install: 'update'
- php: 8.1
output: '-o default'
phpcq_install: 'update'
- php: 8.2
output: '-o default'
phpcq_install: 'update'
steps:
- name: Pull source
uses: actions/checkout@v2
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Cache composer cache directory
uses: actions/cache@v1
env:
cache-name: composer-cache-dir
with:
path: ~/.cache/composer
key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}
- name: Cache vendor directory
uses: actions/cache@v1
env:
cache-name: vendor
with:
path: vendor
key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-
- name: Cache phpcq directory
uses: actions/cache@v1
env:
cache-name: phpcq
with:
path: .phpcq
key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/.phpcq.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-
- name: Install composer dependencies
run: composer install
- name: Install phpcq toolchain
run: ./vendor/bin/phpcq ${{ matrix.phpcq_install }} -v
- name: Run tests
run: ./vendor/bin/phpcq run -v ${{ matrix.output }}
- name: Upload build directory to artifact
uses: actions/upload-artifact@v2
if: ${{ success() }} || ${{ failure() }}
with:
name: phpcq-builds-php-${{ matrix.php }}
path: .phpcq/build/

3
.gitignore vendored
View File

@@ -25,3 +25,6 @@ build.properties
# NPM
node_modules
.phpcq
phpcq.yaml

1
.phpcq.lock Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,41 +0,0 @@
dist: xenial
addons:
apt:
packages:
- ant-optional
language: php
php:
- "7.3"
- "7.2"
- "7.1"
- "7.4snapshot"
- "nightly"
env:
- CONTAO_VERSION=contao/core-bundle ~4.4.0
- CONTAO_VERSION=contao/core-bundle ~4.5.0
- CONTAO_VERSION=contao/core-bundle ~4.6.0
matrix:
exclude:
allow_failures:
- php: "nightly"
- php: "7.4snapshot"
before_script:
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- travis_retry composer self-update && composer --version
- travis_retry composer require $CONTAO_VERSION --no-update
- travis_retry composer update --prefer-dist --no-interaction
script: ant -keep-going
git:
depth: 2147483647
cache:
directories:
- vendor

View File

@@ -8,6 +8,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [3.2.3] - 2022-02-22
### Changed
- Support symfony 5 (Contao 4.13 support) ([#110](https://github.com/netzmacht/contao-leaflet-maps/issues/110))
- Support doctrine/dbal 3 (Contao 4.13 support) ([#110](https://github.com/netzmacht/contao-leaflet-maps/issues/110))
- Fix missing icon in backend navigation ([#101](https://github.com/netzmacht/contao-leaflet-maps/issues/101))
- Fix empty help wizard ([#99](https://github.com/netzmacht/contao-leaflet-maps/issues/99))
- Update leaflet providers ([111](https://github.com/netzmacht/contao-leaflet-maps/issues/111), [102](https://github.com/netzmacht/contao-leaflet-maps/issues/102))
- Fix tile layer implementation ([#108](https://github.com/netzmacht/contao-leaflet-maps/issues/108))
- Fix access to tile layer fields ([#107](https://github.com/netzmacht/contao-leaflet-maps/issues/107))
- Fix nexted folder structure ([#97](https://github.com/netzmacht/contao-leaflet-maps/issues/97))
## [3.2.2] - 2020-12-18
### Fixed
- Remove template debug placeholders, it breaks generated javascript ([#93](https://github.com/netzmacht/contao-leaflet-maps/issues/93))
- Generate absolute urls for file layers ([#92](https://github.com/netzmacht/contao-leaflet-maps/issues/92))
## [3.2.1] - 2020-09-02
### Fixed
- Do not append javascript to the body anymore as consent tools might interrupt rendering
## [3.2.0] - 2020-08-28
### Added
- Add support for consent tools based on `hofff/contao-consent-bridge`
## [3.1.7] - 2020-08-28
### Fixed
@@ -151,7 +183,10 @@ Implemented enhancements
- Bypass filesystem cache in debug mode
- Changelog added
[Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.7...hotfix/3.1.8
[Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.2...hotfix/3.2.3
[3.2.2]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.1...3.2.2
[3.2.1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.0...3.2.1
[3.2.0]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.7...3.2.0
[3.1.7]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.6...3.1.7
[3.1.6]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.5...3.1.6
[3.1.5]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.4...3.1.5

View File

@@ -1,4 +0,0 @@
phpcs.standard = ${basedir}/vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/ruleset.xml
phpmd.ruleset = ${basedir}/vendor/phpcq/coding-standard/phpmd/ruleset.xml
phpcs.excluded = src/Bundle/Resources/contao/languages,src/Bundle/Resources/public/js
phpcpd.excluded = contao

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="netzmacht/contao-leaflet-maps" default="build">
<!-- import the main build system -->
<import file="vendor/phpcq/phpcq/phpcq.main.xml" />
</project>

View File

@@ -1,13 +1,13 @@
{
"name": "netzmacht/contao-leaflet-maps",
"type": "contao-bundle",
"description": "Contao Leaflet maps integration",
"license": "LGPL-3.0-or-later",
"type": "contao-bundle",
"keywords": [
"contao",
"maps",
"leaflet"
],
"license": "LGPL-3.0-or-later",
"authors": [
{
"name": "David Molineus",
@@ -16,64 +16,76 @@
"role": "Developer"
}
],
"support": {
"email": "mail@netzmacht.de",
"issues": "https://github.com/netzmacht/contao-leaflet-maps/issues",
"source": "https://github.com/netzmacht/contao-leaflet-maps",
"docs": "http://leaflet-maps-for-contao.readthedocs.org/"
},
"require": {
"php": ">=7.1",
"php": "^7.1 || ^8.0",
"ext-json": "*",
"ext-pdo": "*",
"contao-community-alliance/meta-palettes": "^2.0 || ^1.11",
"contao/core-bundle": "~4.4",
"doctrine/cache": "^1.0",
"doctrine/dbal": "^2.5",
"menatwork/contao-multicolumnwizard": "^3.3",
"contao-community-alliance/meta-palettes": "^2.0",
"contao/core-bundle": "^4.9",
"doctrine/dbal": "^2.11 || ^3.0",
"menatwork/contao-multicolumnwizard-bundle": "^3.4",
"netzmacht/contao-leaflet-geocode-widget": "^1.2",
"netzmacht/contao-leaflet-libraries": "^1.3.4",
"netzmacht/contao-leaflet-libraries": "^1.7.1.1",
"netzmacht/contao-page-context": "~1.0",
"netzmacht/contao-toolkit": "~3.0",
"netzmacht/contao-toolkit": "^3.7",
"netzmacht/php-javascript-builder": "^1.0",
"netzmacht/php-leaflet": "^1.1.0",
"symfony/config": "~3.3 || ~4.0",
"symfony/dependency-injection": "^3.4.26 || ^4.1.12",
"symfony/event-dispatcher": "~3.3 || ~4.0",
"symfony/filesystem": "~3.3 || ~4.0",
"symfony/http-kernel": "~3.3 || ~4.0",
"symfony/twig-bundle": "~3.3 || ~4.0",
"symfony/translation": "~3.3 || ~4.0",
"twig/twig": "^1.3.35 || ^2.0"
"symfony/cache-contracts": "^1.1 || ^2.0",
"symfony/config": "^4.4 || ^5.1",
"symfony/dependency-injection": "^4.4 || ^5.1",
"symfony/event-dispatcher": "^4.4 || ^5.1",
"symfony/event-dispatcher-contracts": "^1.1 || ^2.0",
"symfony/filesystem": "^4.4 || ^5.1",
"symfony/http-foundation": "^4.4 || ^5.1",
"symfony/http-kernel": "^4.4 || ^5.1",
"symfony/routing": "^4.4 || ^5.1",
"symfony/templating": "^4.4 || ^5.1 || ^6.2",
"symfony/translation-contracts": "^1.1 || ^2.0",
"symfony/twig-bundle": "^4.4 || ^5.1",
"twig/twig": "^2.0 || ^3.0"
},
"require-dev": {
"contao/manager-plugin": "^2.1",
"phpcq/all-tasks": "^1.2"
"hofff/contao-consent-bridge": "^1.0",
"phpcq/coding-standard": "^2.1",
"phpcq/runner-bootstrap": "^1.0@dev"
},
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev",
"dev-develop": "3.2.x-dev",
"dev-support/2.x": "2.0.x-dev"
},
"contao": {
"transifex": {
"project": "contao-leaflet-maps",
"prefix": "core-",
"languages_cto": "src/Bundle/Resources/contao/languages",
"languages_tx": ".tx"
}
},
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin"
"conflict": {
"hofff/contao-consent-bridge": "<1.0 || >= 2.0"
},
"autoload": {
"psr-4": {
"Netzmacht\\Contao\\Leaflet\\": "src/"
}
},
"autoload-dev": {
"files": [
"vendor/phpcq/autoload-validation/hacks/contao-hack.php"
]
"config": {
"allow-plugins": {
"contao-components/installer": true,
"contao/manager-plugin": true,
"contao-community-alliance/composer-plugin": true,
"php-http/discovery": true
}
},
"support": {
"email": "mail@netzmacht.de",
"issues": "https://github.com/netzmacht/contao-leaflet-maps/issues",
"source": "https://github.com/netzmacht/contao-leaflet-maps",
"docs": "http://leaflet-maps-for-contao.readthedocs.org/"
"extra": {
"branch-alias": {
"dev-develop": "3.3.x-dev",
"dev-master": "3.2.x-dev",
"dev-support/2.x": "2.0.x-dev"
},
"contao": {
"transifex": {
"languages_cto": "src/Bundle/Resources/contao/languages",
"languages_tx": ".tx",
"prefix": "core-",
"project": "contao-leaflet-maps"
}
},
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin"
}
}

47
package-lock.json generated
View File

@@ -519,12 +519,19 @@
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
},
"copy-props": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz",
"integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==",
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.5.tgz",
"integrity": "sha512-XBlx8HSqrT0ObQwmSzM7WE5k8FxTV75h1DX1Z3n6NhQ/UYYAvInWYmG06vFt7hQZArE2fuO62aihiWIVQwh1sw==",
"requires": {
"each-props": "^1.3.0",
"is-plain-object": "^2.0.1"
"each-props": "^1.3.2",
"is-plain-object": "^5.0.0"
},
"dependencies": {
"is-plain-object": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
}
}
},
"core-util-is": {
@@ -1259,9 +1266,9 @@
}
},
"hosted-git-info": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg=="
"version": "2.8.9",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw=="
},
"inflight": {
"version": "1.0.6",
@@ -1278,9 +1285,9 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz",
"integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ=="
},
"interpret": {
"version": "1.4.0",
@@ -1658,9 +1665,9 @@
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -1932,9 +1939,9 @@
"integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM="
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
},
"path-root": {
"version": "0.1.1",
@@ -2804,9 +2811,9 @@
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
},
"y18n": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
"integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE="
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz",
"integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ=="
},
"yargs": {
"version": "7.1.1",

98
phpcq.yaml.dist Normal file
View File

@@ -0,0 +1,98 @@
phpcq:
repositories:
- https://phpcq.github.io/repository/repository.json
directories:
- src
plugins:
composer-require-checker:
version: ^1.0
signed: false
phpmd:
version: ^1.0
signed: false
requirements:
phpmd:
signed: false
phpcpd:
version: ^1.1
signed: false
phploc:
version: ^1.0
signed: false
phpcs:
version: ^1.0
signed: false
composer-normalize:
version: ^1.0
signed: false
trusted-keys:
# composer require checker
- 033E5F8D801A2F8D
# sb@sebastian-bergmann.de
- 4AA394086372C20A
# magl@magll.net
- D2CCAC42F6295E7D
# PHP_CodeSniffer
- 31C7E470E2138192
# Composer normalize
- C00543248C87FB13
# phpmd
- A4E55EA12C7C085C
tasks:
fix:
- composer-normalize-fix
- phpcbf
verify:
- composer-require-checker
- composer-normalize
analyze:
- phploc
- phpcpd
- phpmd
- phpcs
default:
- verify
- analyze
phpcpd:
plugin: phpcpd
phpmd:
config:
ruleset:
- vendor/phpcq/coding-standard/phpmd/ruleset.xml
composer-normalize:
config:
ignore_output:
- '#Root package is not of type "project", we will not installing Contao extensions\.#'
composer-require-checker:
plugin: composer-require-checker
config:
config_file: '.composer-require-checker.json'
phpcs:
plugin: phpcs
config: &phpcs-config
standard: ~
excluded:
- src/Bundle/Resources/contao/languages
- src/Bundle/Resources/public/js
phpcbf:
plugin: phpcs
config:
<<: *phpcs-config
fix: true
composer-normalize-fix:
plugin: composer-normalize
config:
dry_run: false

4
phpcs.xml.dist Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="ContaoToolkit">
<rule ref="vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/ruleset.xml" />
</ruleset>

View File

@@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class ChainRenderer.

View File

@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Contao\FilesModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class FileLabelRenderer

View File

@@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Interface LayerLabelRenderer.

View File

@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class MarkersLabelRenderer.

View File

@@ -15,7 +15,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Contao\StringUtil;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class OverpassLabelRenderer.

View File

@@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Backend label renderer for provider layer.

View File

@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class ReferenceLabelRenderer.

View File

@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Netzmacht\Contao\Leaflet\Model\VectorModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class VectorsLabelRenderer.

View File

@@ -0,0 +1,37 @@
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Bundle\ConsentBridge;
use Hofff\Contao\Consent\Bridge\Bridge;
use Hofff\Contao\Consent\Bridge\Plugin as ConsentBridgePlugin;
use Hofff\Contao\Consent\Bridge\Render\RenderInformation;
/**
* Consent Bridge plugin for leaflet.
*/
final class Plugin implements ConsentBridgePlugin
{
/**
* {@inheritDoc}
*/
public function load(Bridge $bridge): void
{
$renderInformation = RenderInformation::autoRenderWithPlaceholder('leaflet_consent_bridge_placeholder');
$bridge
->supportContentElement('leaflet', $renderInformation)
->supportFrontendModule('leaflet', $renderInformation);
}
}

View File

@@ -44,7 +44,8 @@ class Plugin implements BundlePluginInterface, RoutingPluginInterface
[
ContaoCoreBundle::class,
NetzmachtContaoToolkitBundle::class,
NetzmachtContaoPageContextBundle::class
NetzmachtContaoPageContextBundle::class,
'leaflet-libs',
]
)
->setReplace(['leaflet']),

View File

@@ -18,6 +18,8 @@ use Netzmacht\LeafletPHP\Assets;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use function array_pad;
/**
* Class RegisterLibrariesPass.
*
@@ -43,12 +45,12 @@ class RegisterLibrariesPass implements CompilerPassInterface
foreach ($libraries as $name => $assets) {
if (!empty($assets['css'])) {
list ($source, $type) = (array) $assets['css'];
[$source, $type] = array_pad((array) $assets['css'], 2, null);
$definition->addMethodCall('registerStylesheet', [$name, $source, $type ?: Assets::TYPE_FILE]);
}
if (!empty($assets['javascript'])) {
list ($source, $type) = (array) $assets['javascript'];
[$source, $type] = array_pad((array) $assets['javascript'], 2, null);
$definition->addMethodCall('registerJavascript', [$name, $source, $type ?: Assets::TYPE_FILE]);
}
}

View File

@@ -4,7 +4,7 @@ services:
public: true
arguments:
- '@netzmacht.contao_toolkit.repository_manager'
- '@templating'
- '@netzmacht.contao_toolkit.template_renderer'
- '@filesystem'
- '@netzmacht.contao_toolkit.contao.system_adapter'
- '%netzmacht.contao_leaflet.cache_dir%'

View File

@@ -77,6 +77,7 @@ services:
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
arguments:
- '@netzmacht.contao_toolkit.repository_manager'
- '@netzmacht.contao_toolkit.contao.environment_adapter'
tags:
- { name: netzmacht.contao_leaflet.mapper }

View File

@@ -1,13 +1,13 @@
parameters:
netzmacht.contao_leaflet.providers:
OpenStreetMap:
variants: ['Mapnik', 'BlackAndWhite', 'DE', 'CH', 'France', 'HOT', 'BZH']
variants: ['Mapnik', 'DE', 'CH', 'France', 'HOT', 'BZH']
OpenSeaMap: []
OpenTopoMap: []
OPNVKarte: []
OpenPtMap: []
OpenTopoMap: []
OpenRailwayMap: []
@@ -15,6 +15,9 @@ parameters:
SafeCast: []
Stadia:
variants: ['AlidadeSmooth', 'AlidadeSmoothDark', 'OSMBright', 'Outdoors']
Thunderforest:
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\ThunderforestProvider'
variants:
@@ -25,12 +28,13 @@ parameters:
- 'Landscape'
- 'Outdoors'
- 'Pioneer'
- 'MobileAtlas'
- 'Neighbourhood'
options:
apiKey: 'tile_provider_key'
fields: ['tile_provider_key']
OpenMapSurfer:
variants: ['Roads', 'AdminBounds', 'Grayscale']
CyclOSM: []
Hydda:
variants: ['Full', 'Base', 'RoadsAndLabels']
@@ -41,6 +45,8 @@ parameters:
accessToken: 'tile_provider_key'
fields: ['tile_provider_key']
MapTiler: []
Stamen:
variants:
- 'Toner'
@@ -112,6 +118,7 @@ parameters:
- 'hybridDayMobile'
- 'hybridDayTransit'
- 'hybridDayGrey'
- 'hybridDayTraffic'
- 'pedestrianDay'
- 'pedestrianNight'
- 'satelliteDay'

View File

@@ -16,7 +16,7 @@ services:
- '@netzmacht.contao_leaflet.cache'
- '@netzmacht.contao_leaflet.frontend.data_controller'
- '@netzmacht.contao_toolkit.repository_manager'
- '@templating'
- '@netzmacht.contao_toolkit.template_renderer'
netzmacht.contao_leaflet.libraries:
class: Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration
@@ -29,12 +29,14 @@ services:
- '%netzmacht.contao_leaflet.filters%'
netzmacht.contao_leaflet.cache.default:
class: Doctrine\Common\Cache\FilesystemCache
class: Symfony\Component\Cache\Adapter\FilesystemAdapter
arguments:
- 'netzmacht.contao_leaflet'
- 0
- '%netzmacht.contao_leaflet.cache_dir%'
netzmacht.contao_leaflet.cache.debug:
class: Doctrine\Common\Cache\ArrayCache
class: Symfony\Component\Cache\Adapter\ArrayAdapter
netzmacht.contao_leaflet.frontend.value_filter:
class: Netzmacht\Contao\Leaflet\Frontend\ValueFilter
@@ -138,3 +140,7 @@ services:
arguments:
- '@twig'
- '%kernel.project_dir%'
Netzmacht\Contao\Leaflet\Bundle\ConsentBridge\Plugin:
tags:
- { name: hofff_contao_consent_bridge.plugin }

View File

@@ -5,7 +5,8 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
@@ -67,7 +68,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"',
],
'toggle' => [

View File

@@ -5,7 +5,8 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
@@ -78,7 +79,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"',
],
'toggle' => [

View File

@@ -5,11 +5,14 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
\Contao\Controller::loadLanguageFile('leaflet');
$GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'config' => [
'dataContainer' => 'Table',
@@ -71,6 +74,11 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();"',
],
'toggleNodes' => [
'href' => 'ptg=all',
'class' => 'header_toggle',
'showOnSelect' => true,
],
],
'operations' => [
'markers' => [
@@ -105,7 +113,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"',
],
'toggle' => [
@@ -633,7 +641,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'exclude' => true,
'inputType' => 'text',
'default' => '',
'eval' => ['maxlength' => 255, 'tl_class' => 'long', 'allowHtml' => true],
'eval' => ['maxlength' => 255, 'tl_class' => 'clr long', 'allowHtml' => true],
'sql' => "varchar(255) NOT NULL default ''",
],
'tms' => [

View File

@@ -5,7 +5,9 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
@@ -73,7 +75,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"',
],
'show' => [
@@ -426,10 +428,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
'exclude' => true,
'inputType' => 'textarea',
'eval' => [
'tl_class' => 'clr lng',
'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
'tl_class' => 'clr lng',
'preserveTags' => true,
'decodeEntities' => true,
'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
],
'sql' => 'text NULL',
],

View File

@@ -5,7 +5,9 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
@@ -78,7 +80,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"',
],
'toggle' => [
@@ -339,9 +341,11 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
'inputType' => 'textarea',
'eval' => [
'tl_class' => 'clr lng',
'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
'preserveTags' => true,
'decodeEntities' => true,
'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
],
'sql' => 'text NULL',
],

View File

@@ -5,7 +5,8 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
@@ -78,7 +79,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"',
],
'toggle' => [

View File

@@ -5,7 +5,8 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
@@ -78,7 +79,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"',
],
'toggle' => [

View File

@@ -5,7 +5,9 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
@@ -84,7 +86,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"',
],
'toggle' => [
@@ -378,10 +380,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
'exclude' => true,
'inputType' => 'textarea',
'eval' => [
'tl_class' => 'clr lng',
'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
'tl_class' => 'clr lng',
'preserveTags' => true,
'decodeEntities' => true,
'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
],
'sql' => 'text NULL',
],

View File

@@ -9,5 +9,5 @@
</div>
<!-- indexer::continue -->
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
<script><?= $this->javascript ?></script>

View File

@@ -9,4 +9,4 @@
</div>
<!-- indexer::continue -->
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
<script><?= $this->javascript ?></script>

View File

@@ -23,6 +23,10 @@
padding-left: 20px !important;
}
.tl_listing .tl_left {
overflow: unset;
}
.long .tl_text_2 {
width: 325px;
}

View File

@@ -1,5 +1,5 @@
#tl_navigation .tl_level_1_group .group-leaflet {
#tl_navigation .group-leaflet {
background: url(../img/leaflet.svg) 3px 2px no-repeat;
}

View File

@@ -15,7 +15,7 @@ namespace Netzmacht\Contao\Leaflet\Event;
use Contao\Model;
use Netzmacht\Contao\Leaflet\Mapper\Request;
use Netzmacht\LeafletPHP\Definition;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Class BuildDefinitionEvent is emitted when the mapper maps between the model and the definition.

View File

@@ -14,7 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Event;
use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonObject;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Class ConvertToGeoJsonEvent is emitted when the DefinitionMapper converts a definition to a geo json feature.

View File

@@ -12,7 +12,7 @@
namespace Netzmacht\Contao\Leaflet\Event;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Class GetHashEvent is emitted then a hash for a data object with an unknown type is required.

View File

@@ -13,7 +13,7 @@
namespace Netzmacht\Contao\Leaflet\Event;
use Netzmacht\LeafletPHP\Definition\Map;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Class GetJavascriptEvent is emitted after the map javascript was created.

View File

@@ -24,7 +24,7 @@ use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Component\Hybrid\AbstractHybrid;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class HybridTrait provides method required by the frontend module and content element the same time.

View File

@@ -5,7 +5,8 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @author Sven Baumnn <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
@@ -15,6 +16,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Frontend\Assets;
use Contao\CoreBundle\Framework\ContaoFrameworkInterface as ContaoFramework;
use Traversable;
/**
* Class LibrariesConfiguration.
@@ -45,7 +47,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function getIterator()
public function getIterator(): Traversable
{
$this->framework->initialize();
@@ -57,7 +59,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
$this->framework->initialize();
@@ -81,7 +83,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->framework->initialize();
@@ -93,7 +95,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
$this->framework->initialize();

View File

@@ -22,7 +22,7 @@ use Netzmacht\Contao\Toolkit\Component\Component;
use Netzmacht\Contao\Toolkit\Component\ComponentFactory;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class MapElementFactory

View File

@@ -93,7 +93,7 @@ class DataController
$filter = null;
}
list($data, $error) = $this->loadData($mapProvider, $input['type'], $input['id'], $filter);
[$data, $error] = $this->loadData($mapProvider, $input['type'], $input['id'], $filter);
$this->encodeData($input['format'], $data);
} catch (\Exception $e) {
if ($this->debugMode) {

View File

@@ -14,7 +14,6 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Frontend\Module;
use Contao\Config;
use Contao\CoreBundle\Framework\Adapter;
use Contao\Input;
use Netzmacht\Contao\Leaflet\MapProvider;
@@ -22,7 +21,7 @@ use Netzmacht\Contao\Toolkit\Component\Component;
use Netzmacht\Contao\Toolkit\Component\ComponentFactory;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class MapElementFactory

View File

@@ -18,7 +18,7 @@ use Contao\CoreBundle\Event\MenuEvent;
use Netzmacht\Contao\Toolkit\View\Assets\AssetsManager;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\RouterInterface as Router;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class BackendMenuListener adds backend entries to the navigation.

View File

@@ -147,9 +147,9 @@ class ControlDcaListener extends AbstractListener
$statement = $this->connection->prepare($query);
$statement->bindValue('cid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
return $statement->fetchAll();
return $result->fetchAllAssociative();
}
/**
@@ -167,9 +167,9 @@ class ControlDcaListener extends AbstractListener
$query = 'SELECT * FROM tl_leaflet_control_layer WHERE cid=:cid order BY sorting';
$statement = $this->connection->prepare($query);
$statement->bindValue('cid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
while ($row = $statement->fetch()) {
while ($row = $result->fetchAssociative()) {
$values[$row['lid']] = $row;
}

View File

@@ -20,7 +20,7 @@ use Contao\StringUtil;
use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class Module is the helper for the tl_module dca.
@@ -103,7 +103,7 @@ final class FrontendIntegrationListener
)
),
Image::getHtml(
'alias.gif',
'alias.svg',
$this->translator->trans('editalias.0', [$dataContainer->value], 'contao_tl_content'),
'style="vertical-align:top"'
)

View File

@@ -25,7 +25,7 @@ use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class Layer is the helper class for the tl_leaflet_layer dca.
@@ -197,7 +197,7 @@ class LayerDcaListener extends AbstractListener
if (!empty($this->layers[$row['type']]['icon'])) {
$src = $this->layers[$row['type']]['icon'];
} else {
$src = 'iconPLAIN.gif';
$src = 'iconPLAIN.svg';
}
$activeIcon = $src;
@@ -275,12 +275,12 @@ class LayerDcaListener extends AbstractListener
$pasteAfterUrl,
StringUtil::specialchars($this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)),
Image::getHtml(
'pasteafter.gif',
'pasteafter.svg',
$this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)
)
);
if (!empty($this->layers[$row['type']]['children'])) {
if (isset($row['type']) && !empty($this->layers[$row['type']]['children'])) {
$pasteIntoUrl = $this->backendAdapter->addToUrl(
sprintf(
'act=%s&amp;mode=2&amp;pid=%s%s',
@@ -295,12 +295,12 @@ class LayerDcaListener extends AbstractListener
$pasteIntoUrl,
StringUtil::specialchars($this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)),
Image::getHtml(
'pasteinto.gif',
'pasteinto.svg',
$this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)
)
);
} elseif ($row['id'] > 0) {
$buffer .= Image::getHtml('pasteinto_.gif');
$buffer .= Image::getHtml('pasteinto_.svg');
}
return $buffer;
@@ -361,25 +361,25 @@ class LayerDcaListener extends AbstractListener
if ($undoId) {
$statement = $this->connection->prepare('SELECT * FROM tl_undo WHERE id=:id LIMIT 0,1');
$statement->bindValue('id', $undoId);
$statement->execute();
$result = $statement->executeQuery();
$undo = $statement->fetch();
$undo = $result->fetchAssociative();
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE lid=:lid');
$statement->bindValue('lid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
$undo['data'] = StringUtil::deserialize($undo['data'], true);
while ($row = $statement->fetch()) {
while ($row = $result->fetchAssociative()) {
$undo['data']['tl_leaflet_map_layer'][] = $row;
}
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_control_layer WHERE lid=:lid');
$statement->bindValue('lid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
$undo['data']['tl_leaflet_control_layer'] = $statement->fetchAll();
$undo['data']['tl_leaflet_control_layer'] = $result->fetchAllAssociative();
$this->connection->update('tl_undo', ['data' => $undo['data']], ['id' => $undo['id']]);
}

View File

@@ -17,9 +17,9 @@ use Contao\DataContainer;
use Contao\System;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer;
use Netzmacht\LeafletPHP\Value\LatLng;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
/**
* Class Leaflet is the base helper providing different methods.
@@ -50,11 +50,11 @@ class LeafletDcaListener
private $repositoryManager;
/**
* Template engine.
* Template renderer.
*
* @var TemplateEngine
* @var TemplateRenderer
*/
private $templateEngine;
private $templateRenderer;
/**
* System adapter.
@@ -67,20 +67,20 @@ class LeafletDcaListener
* LeafletCallbacks constructor.
*
* @param RepositoryManager $repositoryManager Repository manager.
* @param TemplateEngine $templateEngine Template engine.
* @param TemplateRenderer $templateRenderer Template renderer.
* @param Filesystem $fileSystem File system.
* @param Adapter|System $systemAdapter Contao system adapter.
* @param string $cacheDir Cache dir.
*/
public function __construct(
RepositoryManager $repositoryManager,
TemplateEngine $templateEngine,
TemplateRenderer $templateRenderer,
Filesystem $fileSystem,
$systemAdapter,
string $cacheDir
) {
$this->repositoryManager = $repositoryManager;
$this->templateEngine = $templateEngine;
$this->templateRenderer = $templateRenderer;
$this->fileSystem = $fileSystem;
$this->systemAdapter = $systemAdapter;
$this->cacheDir = $cacheDir;
@@ -125,7 +125,7 @@ class LeafletDcaListener
$data['marker'] = null;
}
return $this->templateEngine->render('toolkit:be:be_leaflet_geocode.html5', $data);
return $this->templateRenderer->render('be:be_leaflet_geocode', $data);
}
/**

View File

@@ -24,9 +24,8 @@ use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use PDO;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class Map is the helper class for the tl_leaflet_map dca.
@@ -136,12 +135,9 @@ class MapDcaListener extends AbstractListener
{
$statement = $this->connection->prepare('SELECT lid FROM tl_leaflet_map_layer WHERE mid=:mid ORDER BY sorting');
$statement->bindValue('mid', $dataContainer->id);
$result = $statement->executeQuery();
if ($statement->execute()) {
return $statement->fetchAll(PDO::FETCH_COLUMN, 0);
}
return [];
return $result->fetchFirstColumn();
}
/**
@@ -159,9 +155,9 @@ class MapDcaListener extends AbstractListener
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
$statement->bindValue('mid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
while ($row = $statement->fetch()) {
while ($row = $result->fetchAssociative()) {
$values[$row['lid']] = $row;
}
@@ -239,9 +235,9 @@ class MapDcaListener extends AbstractListener
{
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
$statement->bindValue('mid', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
while ($row = $result->fetchAssociative()) {
unset($row['id']);
$row['tstamp'] = time();
$row['mid'] = $insertId;

View File

@@ -145,9 +145,9 @@ class MarkerDcaListener
$statement = $this->connection->prepare($query);
$statement->bindValue('id', $dataContainer->id);
$statement->execute();
$result = $statement->executeQuery();
if ($row = $statement->fetch()) {
if ($row = $result->fetchAssociative()) {
$buffer = $row['latitude'];
if ($buffer && $row['longitude']) {

View File

@@ -16,7 +16,7 @@ use Contao\DataContainer;
use Contao\StringUtil;
use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\LeafletPHP\Value\LatLng;
use Symfony\Component\Translation\TranslatorInterface as Translator;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class Validator.

View File

@@ -178,8 +178,8 @@ final class GeoJsonListener
private function parseModelValue(Model $model, &$property)
{
if (is_array($property)) {
list($property, $type) = $property;
$value = $model->$property;
[$property, $type] = $property;
$value = $model->$property;
switch ($type) {
case 'array':

View File

@@ -143,12 +143,12 @@ class LoadAssetsListener
$assets = $this->libraries[$library];
if (!empty($assets['css'])) {
list ($source, $type) = (array) $assets['css'];
[$source, $type] = array_pad((array) $assets['css'], 2, null);
$this->assets->addStylesheet($source, $type ?: Assets::TYPE_FILE);
}
if (!empty($assets['javascript'])) {
list ($source, $type) = (array) $assets['javascript'];
[$source, $type] = array_pad((array) $assets['javascript'], 2, null);
$this->assets->addJavascript($source, $type ?: Assets::TYPE_FILE);
}
}

View File

@@ -60,11 +60,11 @@ final class RegisterLibrariesListener
{
foreach ($this->libraries as $name => $assets) {
if (!empty($assets['css'])) {
list ($source, $type) = (array) $assets['css'];
[$source, $type] = array_pad((array) $assets['css'], 2, null);
$this->leaflet->registerStylesheet($name, $source, $type ?: Assets::TYPE_FILE);
}
if (!empty($assets['javascript'])) {
list ($source, $type) = (array) $assets['javascript'];
[$source, $type] = array_pad((array) $assets['javascript'], 2, null);
$this->leaflet->registerJavascript($name, $source, $type ?: Assets::TYPE_FILE);
}
}

View File

@@ -5,6 +5,7 @@
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
@@ -13,7 +14,6 @@
namespace Netzmacht\Contao\Leaflet;
use Contao\Input;
use Doctrine\Common\Cache\Cache;
use Netzmacht\Contao\Leaflet\Encoder\ContaoAssets;
use Netzmacht\Contao\Leaflet\Event\GetJavascriptEvent;
use Netzmacht\Contao\Leaflet\Filter\Filter;
@@ -24,11 +24,13 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\View\Template\TemplateReference;
use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer;
use Netzmacht\LeafletPHP\Definition\Map;
use Netzmacht\LeafletPHP\Leaflet;
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher;
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
use Symfony\Component\Cache\CacheItem;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher;
use Symfony\Contracts\Cache\CacheInterface as Cache;
/**
* Class MapProvider.
@@ -94,11 +96,11 @@ class MapProvider
private $repositoryManager;
/**
* Template engine.
* Template renderer.
*
* @var TemplateEngine
* @var TemplateRenderer
*/
private $templateEngine;
private $templateRenderer;
/**
* Construct.
@@ -111,7 +113,7 @@ class MapProvider
* @param Cache $cache Cache.
* @param DataController $dataController Data controller.
* @param RepositoryManager $repositoryManager Repository manager.
* @param TemplateEngine $templateEngine Template engine.
* @param TemplateRenderer $templateRenderer Template rednerer.
*/
public function __construct(
DefinitionMapper $mapper,
@@ -122,7 +124,7 @@ class MapProvider
Cache $cache,
DataController $dataController,
RepositoryManager $repositoryManager,
TemplateEngine $templateEngine
TemplateRenderer $templateRenderer
) {
$this->mapper = $mapper;
$this->leaflet = $leaflet;
@@ -132,7 +134,7 @@ class MapProvider
$this->cache = $cache;
$this->dataController = $dataController;
$this->repositoryManager = $repositoryManager;
$this->templateEngine = $templateEngine;
$this->templateRenderer = $templateRenderer;
}
/**
@@ -212,25 +214,29 @@ class MapProvider
if ($doCache) {
$cacheKey = $this->getCacheKey($mapId, $filter, $elementId, $template, $style);
if ($this->cache->contains($cacheKey)) {
$cached = $this->cache->fetch($cacheKey);
$this->assets->fromArray($cached['assets']);
if ($this->cache->hasItem($cacheKey)) {
$cached = $this->cache->getItem($cacheKey);
$cachedData = $cached->get();
$this->assets->fromArray($cachedData['assets']);
return $cached['javascript'];
return $cachedData['javascript'];
} else {
$cached = $this->cache->getItem($cacheKey);
}
}
$buffer = $this->doGenerate($model, $filter, $elementId, $template, $style);
if ($doCache) {
$this->cache->save(
$cacheKey,
[
'assets' => $this->assets->toArray(),
'javascript' => $buffer,
],
(int) $model->cacheLifeTime
);
$cached
->expiresAfter((int) $model->cacheLifeTime)
->set(
[
'assets' => $this->assets->toArray(),
'javascript' => $buffer,
]
);
$this->cache->save($cached);
}
return $buffer;
@@ -270,12 +276,19 @@ class MapProvider
$cacheKey .= '.filter_' . md5($filter->toRequest());
}
if ($this->cache->contains($cacheKey)) {
return $this->cache->fetch($cacheKey);
if ($this->cache->hasItem($cacheKey)) {
$cachedItem = $this->cache->getItem($cacheKey);
return $cachedItem->get();
} else {
$cachedItem = $this->cache->getItem($cacheKey);
}
$collection = $this->mapper->handleGeoJson($model, $request);
$this->cache->save($cacheKey, $collection, $model->cacheLifeTime);
$cachedItem
->expiresAfter($model->cacheLifeTime)
->set($collection);
$this->cache->save($cachedItem);
return $collection;
}
@@ -374,7 +387,7 @@ class MapProvider
$javascript = $this->leaflet->build($definition, $this->assets);
$mapId = $definition->getId();
$templateReference = new TemplateReference($template, 'html5', TemplateReference::SCOPE_FRONTEND);
$templateReference = 'fe:' . $template;
$parameters = [
'definition' => $definition,
'model' => $model,
@@ -384,12 +397,16 @@ class MapProvider
'mapId' => $mapId,
];
$content = $this->templateEngine->render($templateReference, $parameters);
$event = new GetJavascriptEvent($definition, $content);
$this->eventDispatcher->dispatch($event::NAME, $event);
$content = $this->templateRenderer->render($templateReference, $parameters);
$content = preg_replace(
['/^<!-- TEMPLATE (START): .+ -->\n*/', '/\n*<!-- TEMPLATE (END): .+ -->$/'],
'',
$content
);
$buffer = $event->getJavascript();
$event = new GetJavascriptEvent($definition, $content);
$this->eventDispatcher->dispatch($event, $event::NAME);
return $buffer;
return $event->getJavascript();
}
}

View File

@@ -20,7 +20,7 @@ use Netzmacht\LeafletPHP\Value\GeoJson\ConvertsToGeoJsonFeature;
use Netzmacht\LeafletPHP\Value\GeoJson\Feature;
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonFeature;
use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher;
/**
* Class DefinitionMapper is the main mapper instance which contains all other mappers as children.
@@ -111,7 +111,7 @@ class DefinitionMapper
if ($definition) {
$event = new BuildDefinitionEvent($definition, $model, $request);
$this->eventDispatcher->dispatch($event::NAME, $event);
$this->eventDispatcher->dispatch($event, $event::NAME);
}
$this->mapped[$hash] = $definition;
@@ -172,7 +172,7 @@ class DefinitionMapper
}
$event = new ConvertToGeoJsonEvent($definition, $feature, $model);
$this->eventDispatcher->dispatch($event::NAME, $event);
$this->eventDispatcher->dispatch($event, $event::NAME);
return $feature;
}
@@ -190,7 +190,7 @@ class DefinitionMapper
private function hash($model, $elementId = null)
{
$event = new GetHashEvent($model);
$this->eventDispatcher->dispatch($event::NAME, $event);
$this->eventDispatcher->dispatch($event, $event::NAME);
$hash = $event->getHash();
if (!$hash) {

View File

@@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
use Contao\CoreBundle\Framework\Adapter;
use Contao\Environment;
use Contao\FilesModel;
use Contao\Model;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
@@ -58,16 +60,25 @@ class FileLayerMapper extends AbstractLayerMapper
*/
private $repositoryManager;
/**
* Environment.
*
* @var Adapter<Environment>
*/
private $environmentAdapter;
/**
* Construct.
*
* @param RepositoryManager $repositoryManager Repository manager.
* @param RepositoryManager $repositoryManager Repository manager.
* @param Adapter<Environment> $environmentAdapter Environment adapter.
*/
public function __construct(RepositoryManager $repositoryManager)
public function __construct(RepositoryManager $repositoryManager, Adapter $environmentAdapter)
{
$this->repositoryManager = $repositoryManager;
parent::__construct();
$this->repositoryManager = $repositoryManager;
$this->environmentAdapter = $environmentAdapter;
}
/**
@@ -103,25 +114,26 @@ class FileLayerMapper extends AbstractLayerMapper
$layerId = $this->getElementId($model, $elementId);
if ($fileModel instanceof FilesModel && $fileModel->type === 'file') {
$url = $this->environmentAdapter->get('url') . '/' . $fileModel->path;
switch ($model->fileFormat) {
case 'gpx':
$layer = new Gpx($layerId, $fileModel->path);
$layer = new Gpx($layerId, $url);
break;
case 'kml':
$layer = new Kml($layerId, $fileModel->path);
$layer = new Kml($layerId, $url);
break;
case 'wkt':
$layer = new Wkt($layerId, $fileModel->path);
$layer = new Wkt($layerId, $url);
break;
case 'geojson':
$layer = new OmnivoreGeoJson($layerId, $fileModel->path);
$layer = new OmnivoreGeoJson($layerId, $url);
break;
case 'topojson':
$layer = new TopoJson($layerId, $fileModel->path);
$layer = new TopoJson($layerId, $url);
break;
default:

View File

@@ -93,7 +93,7 @@ class TileLayerMapper extends AbstractLayerMapper
/** @var TileLayer $definition */
$bounds = StringUtil::deserialize($model->bounds);
if ($request[0] && $request[1]) {
if ($bounds[0] && $bounds[1]) {
$bounds = array_map(
function ($value) {
return explode(',', $value, 3);