From 4ab7250f1518966d364b0eb8162f728fb9d12faa Mon Sep 17 00:00:00 2001 From: Jan Henckens Date: Sun, 21 Jan 2024 11:22:53 +0100 Subject: [PATCH] Schema fix for multisite --- CHANGELOG.md | 5 ++++- composer.json | 2 +- src/models/SeoFieldModel.php | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4317351..aab2280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,14 @@ 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.2 - 2024-01-21 +### Fixed +- Fixed getting schema data for multi-site setups + ## 4.0.1 - 2024-01-21 ### Fixed - Fixed on issue on the schema settings screen, when no settings had been defined yet - ## 4.0.0 - 2024-01-20 ### Added - JSON-LD Schema.org markup diff --git a/composer.json b/composer.json index 6eaee90..fecc7cf 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.1", + "version": "4.0.2", "keywords": [ "craft", "cms", diff --git a/src/models/SeoFieldModel.php b/src/models/SeoFieldModel.php index 2ed3315..5a0b473 100644 --- a/src/models/SeoFieldModel.php +++ b/src/models/SeoFieldModel.php @@ -77,7 +77,10 @@ public function getSchema(Element $element = null) try { $schema = null; - $settings = $this->siteDefault->getSchema(); + $primarySite = Craft::$app->getSites()->getPrimarySite(); + $defaults = SeoFields::getInstance()->defaultsService->getDataBySite($primarySite); + $settings = $defaults->getSchema(); + switch (get_class($element)) { case Entry::class: $schemaSettings = $settings['sections'];