From d693fd7f754176b998f3e2b4d39a0234b0d94f2f Mon Sep 17 00:00:00 2001 From: Jan Henckens Date: Sun, 7 Jul 2024 13:34:47 +0200 Subject: [PATCH] Fix for #95 --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/SeoFields.php | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd16ccd..c2cac38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ 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/). +## 5.0.1 - 2024-07-07 +### Fixed +- Fixed misssing behaviour for categories ([#95](https://github.com/studioespresso/craft-seo-fields/issues/95)) + ## 5.0.0 - 2024-05-22 ### Fixed - Fixed an error with fields that don't use "seo" as a handle ([#94](https://github.com/studioespresso/craft-seo-fields/issues/94)) diff --git a/composer.json b/composer.json index 02d1bdb..7d538c9 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "studioespresso/craft-seo-fields", "description": "Fields for your SEO & OG meta data", "type": "craft-plugin", - "version": "5.0.0", + "version": "5.0.1", "keywords": [ "craft", "cms", diff --git a/src/SeoFields.php b/src/SeoFields.php index 1652242..cbddfda 100644 --- a/src/SeoFields.php +++ b/src/SeoFields.php @@ -14,6 +14,7 @@ use craft\base\Model; use craft\base\Plugin; use craft\commerce\elements\Product; +use craft\elements\Category; use craft\elements\Entry; use craft\events\DefineBehaviorsEvent; use craft\events\ElementEvent; @@ -474,6 +475,10 @@ private function _registerElementBehaviors(): void $event->behaviors[$this->id] = ElementSeoBehavior::class; }); + Event::on(Category::class, Entry::EVENT_DEFINE_BEHAVIORS, function(DefineBehaviorsEvent $event) { + $event->behaviors[$this->id] = ElementSeoBehavior::class; + }); + if (Craft::$app->getPlugins()->isPluginEnabled('commerce')) { /** @phpstan-ignore-next-line */ Event::on(Product::class, Product::EVENT_DEFINE_BEHAVIORS, function(DefineBehaviorsEvent $event) {