diff --git a/CHANGELOG.md b/CHANGELOG.md index f0fea9d..3c80926 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.0 - 2024-09-09 +### Changed +- Updated for Craft 5 + ## 1.0.6 - 2022-01-06 ### Fixed - Fix error when displaying a note from a suspended or deleted user (Fixes #5) diff --git a/composer.json b/composer.json index 6c0e518..34da9a0 100644 --- a/composer.json +++ b/composer.json @@ -1,30 +1,29 @@ { - "name": "ether/notes", - "description": "A note taking field type for Craft CMS 3", - "version": "1.0.6", - "type": "craft-plugin", - "license": "proprietary", - "minimum-stability": "dev", - "require": { - "craftcms/cms": "^3.5" - }, - "autoload": { - "psr-4": { - "ether\\notes\\": "src/" - } - }, - "support": { - "email": "help@ethercreative.co.uk", - "source": "https://github.com/ethercreative/notes", - "issues": "https://github.com/ethercreative/notes/issues" - }, - "extra": { - "handle": "notes", - "name": "Notes", - "developer": "Ether Creative", - "developerUrl": "https://ethercreative.co.uk", - - "class": "ether\\notes\\Notes", - "schemaVersion": "1.0.0" - } + "name": "ether/notes", + "description": "A note taking field type for Craft CMS 3", + "type": "craft-plugin", + "license": "proprietary", + "minimum-stability": "dev", + "require": { + "craftcms/cms": "^5", + "php": "^8.0" + }, + "autoload": { + "psr-4": { + "ether\\notes\\": "src/" + } + }, + "support": { + "email": "help@ethercreative.co.uk", + "source": "https://github.com/ethercreative/notes", + "issues": "https://github.com/ethercreative/notes/issues" + }, + "extra": { + "handle": "notes", + "name": "Notes", + "developer": "Ether Creative", + "developerUrl": "https://ethercreative.co.uk", + "class": "ether\\notes\\Notes", + "schemaVersion": "1.0.0" + } } diff --git a/src/Field.php b/src/Field.php index 36eefc3..e62b15a 100644 --- a/src/Field.php +++ b/src/Field.php @@ -55,7 +55,7 @@ public static function supportedTranslationMethods (): array ]; } - public function normalizeValue ($value, ElementInterface $element = null) + public function normalizeValue ($value, ElementInterface $element = null): mixed { if (!$element) return []; @@ -66,7 +66,7 @@ public function normalizeValue ($value, ElementInterface $element = null) ); } - public function getSettingsHtml () + public function getSettingsHtml (): ?string { // 1.0.2 back-compat $allowDeleting = $this->allowDeleting; @@ -81,7 +81,7 @@ public function getSettingsHtml () ]); } - protected function inputHtml ($value, ElementInterface $element = null): string + protected function inputHtml ($value, ?ElementInterface $element, bool $inline): string { if (!$element || !$element->id) return Craft::t('notes', 'You must save the element before you can add notes!'); diff --git a/src/Notes.php b/src/Notes.php index bcd925d..059af64 100644 --- a/src/Notes.php +++ b/src/Notes.php @@ -26,7 +26,7 @@ class Notes extends Plugin { - public function init () + public function init(): void { parent::init(); @@ -47,22 +47,25 @@ public function init () ); } - public function onRegisterFieldTypes (RegisterComponentTypesEvent $event) + public function onRegisterFieldTypes(RegisterComponentTypesEvent $event): void { $event->types[] = Field::class; } - public function onRegisterPermissions (RegisterUserPermissionsEvent $event) + public function onRegisterPermissions(RegisterUserPermissionsEvent $event): void { - $event->permissions['Notes'] = [ - 'addNotes' => [ - 'label' => Craft::t('notes', 'Add notes'), - ], - 'deleteOwnNotes' => [ - 'label' => Craft::t('notes', 'Delete own notes'), - ], - 'deleteAllNotes' => [ - 'label' => Craft::t('notes', 'Delete all notes'), + $event->permissions['notes'] = [ + 'heading' => 'Notes', + 'permissions' => [ + 'addNotes' => [ + 'label' => Craft::t('notes', 'Add notes'), + ], + 'deleteOwnNotes' => [ + 'label' => Craft::t('notes', 'Delete own notes'), + ], + 'deleteAllNotes' => [ + 'label' => Craft::t('notes', 'Delete all notes'), + ], ], ]; }