From 3f0cbe46f6deb377fbe91e5efb71f99ed66734fb Mon Sep 17 00:00:00 2001 From: Jinzhe Li Date: Sun, 28 May 2023 22:34:11 +0930 Subject: [PATCH 1/3] feature: upgrade to be compatible with Craft 4 --- composer.json | 2 +- src/Geojsonmap.php | 2 +- src/fields/GeojsonmapField.php | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 3634a4b..7061ea0 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ } ], "require": { - "craftcms/cms": "^3.0.0-RC1" + "craftcms/cms": "^4.0" }, "autoload": { "psr-4": { diff --git a/src/Geojsonmap.php b/src/Geojsonmap.php index 49b0986..34c9274 100644 --- a/src/Geojsonmap.php +++ b/src/Geojsonmap.php @@ -57,7 +57,7 @@ class Geojsonmap extends Plugin * * @var string */ - public $schemaVersion = '1.0.0'; + public string $schemaVersion = '1.0.0'; // Public Methods // ========================================================================= diff --git a/src/fields/GeojsonmapField.php b/src/fields/GeojsonmapField.php index 59022cd..165a72b 100644 --- a/src/fields/GeojsonmapField.php +++ b/src/fields/GeojsonmapField.php @@ -65,7 +65,7 @@ public static function displayName(): string /** * @inheritdoc */ - public function rules() + public function rules(): array { $rules = parent::rules(); @@ -111,7 +111,7 @@ public function getContentColumnType(): string /** * @inheritdoc */ - public function normalizeValue($value, ElementInterface $element = null) + public function normalizeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed { return $value; } @@ -119,7 +119,7 @@ public function normalizeValue($value, ElementInterface $element = null) /** * @inheritdoc */ - public function serializeValue($value, ElementInterface $element = null) + public function serializeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed { return parent::serializeValue($value, $element); } @@ -127,7 +127,7 @@ public function serializeValue($value, ElementInterface $element = null) /** * @inheritdoc */ - public function getSettingsHtml() + public function getSettingsHtml(): ?string { // Render the settings template return Craft::$app->getView()->renderTemplate( @@ -141,7 +141,7 @@ public function getSettingsHtml() /** * @inheritdoc */ - public function getInputHtml($value, ElementInterface $element = null): string + public function getInputHtml(mixed $value, ?\craft\base\ElementInterface $element = null): string { // Get our id and namespace $view = Craft::$app->getView(); From af06367d6cae17da9fc92589df358b2f52410e46 Mon Sep 17 00:00:00 2001 From: Jinzhe Li Date: Sun, 28 May 2023 22:38:52 +0930 Subject: [PATCH 2/3] chore: bump version and update README --- CHANGELOG.md | 3 +++ composer.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2d1f41..bb36805 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 2.0.0 +### Feature +- Support Craft 4 ## 1.0.1 - 2019-06-28 ### Fixed diff --git a/composer.json b/composer.json index 7061ea0..9f9246d 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "vardump/geojsonmap", "description": "A craft cms 3 field plugin to draw Leaflet Maps.", "type": "craft-plugin", - "version": "1.0.1", + "version": "2.0.0", "keywords": [ "craft", "cms", From 2c69c615a74a55ac299a098c400a16a4ca6e90d3 Mon Sep 17 00:00:00 2001 From: Jinzhe Li Date: Sun, 28 May 2023 22:45:02 +0930 Subject: [PATCH 3/3] chore: update README --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 035df5d..34370aa 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ -# geojsonmap plugin for Craft CMS 3.x +# geojsonmap plugin for Craft CMS 3.x / 4.x -A craft cms 3 field plugin to draw Leaflet Maps. +A craft cms 3 / 4 field plugin to draw Leaflet Maps. ![Screenshot](resources/img/screenshot.png) ## Requirements -This plugin requires Craft CMS 3.0.0-beta.23 or later. +For Craft 3 please use version `^1.0` +For Craft 4 please use version `^2.0` ## Installation