diff --git a/CHANGELOG.md b/CHANGELOG.md index 636854c..80f1361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,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/). +[4.0.0-beta.3] - 2022-05-03 +- Updated for Craft 4 + ## [1.1.0] - 2022-02-14 ### Fixed diff --git a/README.md b/README.md index 9dc6c82..9536329 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![StyleCI](https://styleci.io/repos/119550758/shield)](https://styleci.io/repos/119550758) [![Total Downloads](https://img.shields.io/packagist/dt/rias/craft-width-fieldtype.svg?style=flat-square)](https://packagist.org/packages/rias/craft-width-fieldtype) -# Width Fieldtype plugin for Craft CMS 3.x +# Width Fieldtype plugin for Craft CMS 4.x Let users choose from predefined widths @@ -17,7 +17,7 @@ This plugin is licensed under a MIT license, which means that it's completely fr ## Requirements -This plugin requires Craft CMS 3.0.0. +This plugin requires Craft CMS 4.0.0-beta.3. ## Installation diff --git a/composer.json b/composer.json index a408b49..28b916e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "hybridinteractive/craft-width-fieldtype", "description": "Let users choose from predefined widths", "type": "craft-plugin", - "version": "1.1.0", + "version": "4.0.0-beta.3", "keywords": [ "craft", "cms", @@ -22,7 +22,7 @@ } ], "require": { - "craftcms/cms": "^3.7.0" + "craftcms/cms": "^4.0.0-beta.1" }, "repositories": [ { diff --git a/src/WidthFieldtype.php b/src/WidthFieldtype.php index 426c101..2222c52 100644 --- a/src/WidthFieldtype.php +++ b/src/WidthFieldtype.php @@ -39,7 +39,7 @@ class WidthFieldtype extends Plugin // ========================================================================= /* @inheritdoc */ - public function init() + public function init(): void { parent::init(); diff --git a/src/fields/Width.php b/src/fields/Width.php index 7aae343..e859d78 100644 --- a/src/fields/Width.php +++ b/src/fields/Width.php @@ -14,6 +14,7 @@ use Craft; use craft\base\ElementInterface; use craft\base\Field; +use phpDocumentor\Reflection\Types\This; use rias\widthfieldtype\assetbundles\widthfieldtype\WidthFieldtypeAsset; use yii\db\Schema; @@ -145,7 +146,7 @@ public function getContentColumnType(): string * * @return mixed The prepared field value */ - public function normalizeValue($value, ElementInterface $element = null) + public function normalizeValue($value, ElementInterface $element = null):? string { return $value; } @@ -158,7 +159,7 @@ public function normalizeValue($value, ElementInterface $element = null) * * @return string|null */ - public function getSettingsHtml() + public function getSettingsHtml(): string { // Register our asset bundle Craft::$app->getView()->registerAssetBundle(WidthFieldtypeAsset::class); @@ -229,7 +230,7 @@ public function getInputHtml($value, ElementInterface $element = null): string * * @return array */ - private static function getOptions() + private static function getOptions(): array { return [ '1/6' => Craft::t('width-fieldtype', '1/6'),