Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Craft 5] Allow modifying link type handle #218

Open
f-elix opened this issue Dec 10, 2024 · 6 comments
Open

[Craft 5] Allow modifying link type handle #218

f-elix opened this issue Dec 10, 2024 · 6 comments

Comments

@f-elix
Copy link

f-elix commented Dec 10, 2024

What are you trying to do?

We have a client that wants their CMS in french, which involves translating field labels. When trying to modify Hyper link type labels, the handle and the Graphql type are automatically modified, based on the label value.

This is already bad in and of itself because in our frontend code we rely on our Graphql types to remain constant.

Another problem caused by this is that some characters used in french (like accents) are not supported, which makes the whole Graphql API crash. That means we can't properly translate CMS user-facing labels.

What's your proposed solution?

The link type label setting should support any character for proper localization, and the link type handle (on which I assume the Graphql type is based on) should by modifiable independently of the label.

Additional context

No response

@engram-design
Copy link
Member

There's certainly some "magic" going on behind the scenes to generate the handle for a link type, and I wasn't overly thrilled about how it all ended up, which is based on the class (not the label, which is translatable). That's because I wanted to simplify link types by not requiring you to enter a handle.

In future Hyper versions, I believe I'll go the route of allowing you to manage that. It'll also make programmatically creating links a bit more clearer. But, I'd want to save that large of a change for a major version, in case of breaking changes.

But more to the point, I can see I'm incorrectly referencing the link type label in the GraphQL type. That at least is fixed for the next release. To get this early, run composer require verbb/hyper:"dev-craft-5 as 2.2.1".

@f-elix
Copy link
Author

f-elix commented Dec 11, 2024

Totally understand that!

Your fix actually allowed us to do exactly what we wanted. We don't need to be able to modify the handle for this.

Thank you very much!

@f-elix
Copy link
Author

f-elix commented Dec 11, 2024

Unfortunately, the latest dev version crashes in the control panel:

image

@engram-design
Copy link
Member

What link types do you have enabled for the field?

@f-elix
Copy link
Author

f-elix commented Dec 12, 2024

We have Entry, Asset, URL, Email and Phone for this field.

@engram-design
Copy link
Member

Very strange, it's stating that there are no linkTypes configured for the field. I'll continue investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants