Closed WHITE-developer closed 8 months ago
This is probably more of a documentation failure than anything. It should affect Craft 4 as well.
The reason this is tricky at the moment is that a Hyper field can contain multiple link types of the same class. You can have multiple "Entry" link types, all labelled differently. As such, you'd tell Hyper which one to use:
$button->handle = 'my-link';
However, the handle for a link type isn't exactly exposed anywhere in the UI, so it makes it difficult to actually know what value to use.
As such, in lieu of adding handles to link types (yet), Hyper will now auto-pick the first available link type for the class that you provide. This is going to cover 99% of people's usage, where they don't have any new additional link types to the default ones.
You can get this in the craft-5
branch.
It also goes without saying that we're yet to tag a Craft 5 release as we're still working on the Craft 5 alpha changes until it reaches beta. Just be wary of changes!
Updated in 2.0.0-beta.1
Describe the bug
When trying to set the links programatically the link type always is set to the default link type selected https://verbb.io/craft-plugins/hyper/docs/developers/link#creating-links-programatically
Depending on how I set the default link type, both buttons will be of that type
Steps to reproduce
Craft CMS version
5.0.0-alpha.8
Plugin version
dev-craft-5 801a741
Multi-site?
Yes
Additional context
No response