hyper
hyper copied to clipboard
Set the empty value to matrix linkValue filed programmatically, the changes doesn't apply
Describe the bug
I encountered with issue after this changes.
When I set the empty value to matrix linkValue filed programmatically, the changes doesn't apply
Steps to reproduce
$element->setFieldValues([
'bulletpoints' => [
'new1' =>
'type' => 'bulletpointsBlock',
'fields' => [
'urlLinkBulletpoint' => [
'links' => [
'type' => 'verbb\\hyper\\links\\Url',
'handle' => 'default-verbb-hyper-links-url',
'newWindow' => false,
'linkValue' => '',
'linkText' => 'Link lable',
],
],
],
];
],
]);
Craft::$app->elements->saveElement($element);
Craft CMS version
5.6.11
Plugin version
2.2.4
Multi-site?
No response
Additional context
No response
No issue on my end with Craft 5.6.13 I'm afraid.
Side note, that should be a plain array of links, not links as an array.
$element->setFieldValues([
'bulletpoints' => [
'new1' => [
'type' => 'bulletpointsBlock',
'fields' => [
'urlLinkBulletpoint' => [
[
'type' => 'verbb\\hyper\\links\\Url',
'handle' => 'default-verbb-hyper-links-url',
'newWindow' => false,
'linkValue' => '',
'linkText' => 'Link lable',
],
],
],
],
],
]);
Although no issue with using links on my end though.
@engram-design do you mean links array should be like this?
$element->setFieldValues([
'bulletpoints' => [
'type' => 'bulletpointsBlock',
'fields' => [
'urlLinkBulletpoint' => [
[
'type' => 'verbb\\hyper\\links\\Url',
'handle' => 'default-verbb-hyper-links-url',
'newWindow' => false,
'linkValue' => '',
'linkText' => 'Link lable',
],
],
],
],
]);
With this changes the same problem
Can you confirm what you see? just no Matrix block at all? Or, what does the Hyper field look like?
The block appears but the inputs "Link" and "Link Text" are empty.
This problem appeared after the fix: https://github.com/craftcms/cms/pull/16818/files
Is this in the context of a multi-site? As in, the primary entry working correctly, but the specific sites don't? Judging from that commit, it seems to be for when an entry is "new for a site". But again, strangely both scenarios are working for me...
Yes, for a multi-site. For all site doesn't work, just create the empty one link.
If the value set up not empty like 'linkValue' => 'https://test.com' it works properly and
Sorry if I'm not following, that seems correct behaviour to me? That's an empty Hyper field with no link value?
In addition, what are the translation/propagation settings for your Matrix and Hyper fields?
That's an empty Hyper field with no link value? If I set only the Link Text field and Link field leaves empty then there is created block with all fields empty, it is expected that Link Text field fills out due to it possible to do in the Control Panel
Translation Method Hyper fields "Not translatable" Propagation Method Matrix fields "Save entries to all sites the owner element is saved in"