From 5d4512708fe45110a10385c3342d249c1d417004 Mon Sep 17 00:00:00 2001 From: Jan Henckens Date: Sun, 7 Jul 2024 13:33:49 +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 2e67615..8c6b154 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/). +## 4.0.10 - 2024-07-07 +### Fixed +- Fixed misssing behaviour for categories ([#95](https://github.com/studioespresso/craft-seo-fields/issues/95)) + ## 4.0.9 - 2024-04-11 ### Fixed - Fixed missing meta description diff --git a/composer.json b/composer.json index 40fd0c9..15bd1aa 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": "4.0.9", + "version": "4.0.10", "keywords": [ "craft", "cms", diff --git a/src/SeoFields.php b/src/SeoFields.php index 8b5abd2..51a72c3 100644 --- a/src/SeoFields.php +++ b/src/SeoFields.php @@ -13,6 +13,7 @@ use Craft; 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; @@ -472,6 +473,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) {