From d256cf6f3aa21461b942763ce67fce48ab96fdfe Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Fri, 6 Dec 2024 22:54:16 +1100 Subject: [PATCH 1/3] Backport propagation fix --- src/fields/HyperField.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fields/HyperField.php b/src/fields/HyperField.php index 03a0641..3e12476 100644 --- a/src/fields/HyperField.php +++ b/src/fields/HyperField.php @@ -313,10 +313,12 @@ public function beforeElementSave(ElementInterface $element, bool $isNew): bool // propagated to other site content, rather than the same site-entry picked across all. // https://github.com/verbb/hyper/issues/45 $changedValue = false; + $value = null; // Only process this for other site elements, as we could be picking a link from another site on purpose - if ($element->propagating) { - $value = $element->getFieldValue($this->handle); + if ($element->propagating && !$element->duplicateOf) { + // Ensure we clone the LinkCollection as we'll be modifying it, but we only want to change it for this propagating element + $value = clone $element->getFieldValue($this->handle); foreach ($value as $linkIndex => $link) { // Only process this for brand-new, unsaved blocks @@ -340,7 +342,7 @@ public function beforeElementSave(ElementInterface $element, bool $isNew): bool $this->_originElement = $element; } - if ($changedValue) { + if ($changedValue && $value) { $element->setFieldValue($this->handle, $value); } From a863ecd805dcd4dfa4350c8aaeb175ffbd56300a Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Wed, 11 Dec 2024 11:16:59 +1100 Subject: [PATCH 2/3] Fix GraphQL `LinkType` using the translated link type label --- src/base/Link.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/Link.php b/src/base/Link.php index 9e23c1e..ec39cdb 100644 --- a/src/base/Link.php +++ b/src/base/Link.php @@ -74,7 +74,7 @@ public static function getRequiredPlugins(): array public static function gqlTypeNameByContext(mixed $context): string { - $linkTypeHandle = StringHelper::toPascalCase($context->label); + $linkTypeHandle = $context::classDisplayName(); return $context->field->handle . '_' . $linkTypeHandle . '_LinkType'; } From a0d269e7d5ce90e48af6ba2057c54f22cccceb07 Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Fri, 27 Dec 2024 12:12:46 +1100 Subject: [PATCH 3/3] version 1.3.5 --- CHANGELOG.md | 6 ++++++ composer.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f2cbac..abad98e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.3.5 - 2024-12-27 + +### Fixed +- Fix GraphQL `LinkType` using the translated link type label. +- Backport propagation fix from Hyper 2. + ## 1.3.4 - 2024-12-02 ### Added diff --git a/composer.json b/composer.json index 3108d1d..db1cf64 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "verbb/hyper", "description": "A user-friendly links field for Craft.", "type": "craft-plugin", - "version": "1.3.4", + "version": "1.3.5", "keywords": [ "craft", "cms",