I'm using this module with drupal 8.2. I have a entity reference field to the taxonomy term of some vocabulary. User could select only one term as a value of this field. During save there is an error in apache log:
[Thu Nov 24 16:56:02.563853 2016] [:error] [pid 33800] [client 109.228.63.58:56009] PHP Fatal error: Cannot create references to/from string offsets nor overloaded objects in /var/www/drupal/core/lib/Drupal/Component/Utility/NestedArray.php on line 158, referer: ...
I have investigated this and noticed that everything is working fine when more than one value is allowed for this field. $form_state->setValueForElement() is called with:
$value = array (
0 => array (
'target_id' => array (
0 =>array (
48 => NULL,
),
),
),
)
when it's not working and with:
$value = array (
0 => array (
'target_id' => '48',
),
);
when it's working. So there is few, unnecessary levels of nesting in that array, and index is replaced with value.
Let me know if you need more information.
And, last but not leasy - thanks for the module! :)
Comment | File | Size | Author |
---|---|---|---|
#13 | validation_broken_with_radios-2830378-13.patch | 955 bytes | alex_optim |
#7 | validation_broken_with_radios-2830378-7.patch | 1.52 KB | alex_optim |
#3 | validation_broken_with_radios-2830378-3.patch | 1.29 KB | alex_optim |
Comments
Comment #2
wikp CreditAttribution: wikp commentedComment #3
alex_optimCheck please my patch.
Comment #4
alex_optimComment #5
yogeshmpawarComment #6
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedUnassigning citing no activity.
Comment #7
alex_optimI was mistaken with my previous patch, so I have created a new one.
Comment #8
yogeshmpawar@alex_optim - Still same error.
Comment #9
alex_optimComment #10
alex_optimComment #11
millenc CreditAttribution: millenc commentedThus bug algo happens on the 8.x-1.0-alpha2 version and I can confirm that the suggested patches don't work. Added a related issue. Any ideas on how to fix this? (it's the only thing stopping me from using this module)
Comment #12
pallavi_sugandhi CreditAttribution: pallavi_sugandhi commentedSame issue not able to save the node with taxonomy reference tree widgets.
Comment #13
alex_optimComment #14
stefank CreditAttribution: stefank at Consult and Design International commented@alex_optim thanks for the patch in #13. I have tested the patch and it seems to be working. The cardinality of the field is set to 1 and using radio buttons. Works even when there are multiple Taxonomy Term Reference Tree on the same form.
Comment #15
fonant CreditAttribution: fonant commentedPatch in #13 fixes errors when using single-item field for me. Thanks!
Comment #16
stopopol CreditAttribution: stopopol commentedI can confirm that #13 works
Please commit this patch for the next release.
Comment #18
alex_optimComment #19
alex_optimComment #20
alex_optim