Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hello
I've installed fivestar on drupal 8, but when I've tried to add a fivestar field to my custom content type I get the error message:
This value should be of the correct primitive type.
Comment | File | Size | Author |
---|---|---|---|
#30 | zero-value-patch-2858251-29.patch | 1.77 KB | maticb |
#27 | default.png | 22.8 KB | Bala.addweb |
#11 | 2858251-11-fivestar-not_really_a_solution.patch | 2.13 KB | floydm |
Comments
Comment #2
myLies CreditAttribution: myLies as a volunteer commentedCan confirm - I've reproduce this on Drupal 8.3
Comment #3
myLies CreditAttribution: myLies as a volunteer commentedand on Drupal 8.1 to
by the way - it's work if you set default value in field settings page
Comment #4
mm3 CreditAttribution: mm3 commentedI'm not sure if it's possible to have 0 stars back though clicking on one star.
And then if I try to go to the form-display I get a 505 page with this error
PHP Fatal error: Cannot use Drupal\\Component\\Utility\\St
ring as String because 'String' is a special class name in /var/www/alpha/modules/contrib/fivestar/src/Plugin/Field/FieldWidget/SelectWidget.p
hp on line 5, referer: http://alpha/admin/structure/types/manage/breads_pastries/fields
---
commenting out this line in fivestar/src/Plugin/Field/FieldWidget/SelectWidget.php seems to solve this last issue
#use Drupal\Component\Utility\String;
Comment #5
myLies CreditAttribution: myLies as a volunteer commentedlooks like It's a core issue https://www.drupal.org/node/2220381
about "PHP Fatal error: Cannot use Drupal\\Component\\Utility\\String as String because 'String' is a special class name"
@mm3 - nice catch! but, it not relate to this issue, may you create a new one?
Comment #6
haunted CreditAttribution: haunted as a volunteer commentedSame problem here.
Comment #7
melonangie CreditAttribution: melonangie commentedIm getting the same error when attaching a fivestar field to the file entity, no options are available for "Voting target".
Comment #8
grinder3011 CreditAttribution: grinder3011 commented#melonangie
Yes, I have the same issue.
Comment #9
brooke_heaton CreditAttribution: brooke_heaton as a volunteer and commentedGetting this issue as well. this_value_should_be-2220381-5.patch did not resolve my issue.
Comment #10
brooke_heaton CreditAttribution: brooke_heaton as a volunteer and commentedActually I can't get Fivestar fields to show up whatsoever. Not sure if this bug is to blame.
Same issue here but on a node.
Comment #11
floydm CreditAttribution: floydm at Affinity Bridge commentedYeah, there are a lot of issues at this point. I'm attaching a patch not as the solution to what is going on here, but hopefully to point folks in the right direction.
The "This value should be of the correct primitive type" seems to be related to the first option value being "-" when the value is getting saved in an integer field. Changing it to "0" eliminates the error, though that change may mess up scoring.
There was a JS error trying to invoke $cancel.text(), which isn't a method.
Ajax voting doesn't appear to be firing yet, which I thought might be because drupal.ajax wasn't included as a dependency, but even after adding it I'm not seeing ajax calls.
Also, for visibility I had to edit and resave nodes to see the voting field display.
Comment #12
Shreya Shetty CreditAttribution: Shreya Shetty as a volunteer and at Trigyn Technologies Ltd commentedComment #13
gg24 CreditAttribution: gg24 as a volunteer and at QED42 commentedThis patch replaces stars with a rating dropdown which changes the rating functionality. As of now the error comes when we attach the respective field to any entity but if we check field listing for that content type the field gets attach to it and it works as expected.This issue still persists.
Thanks!
Comment #14
nikosal CreditAttribution: nikosal commentedI am here to report the same issue with D8.3.1.
PS.
I'd like also to mention, that actually I was using "star rating" in D7, as I was maintaining a site with reviews and allowed only the author of an article to rate. Then I transitioned to D8, star rating is not ported yet, and tried to use this module not actually as a voting tool for all users, but just for the author of the review (they would be able to "vote" instead of "rating"). Alas, this is not working too and my hands are tied.
Comment #15
sharma.amitt16 CreditAttribution: sharma.amitt16 as a volunteer and commentedI am using Drupal 8.3.2
I have created a custom field type which reuses the managed_file. Everything is working fine. Field is created and custom field settings are also saved. But when I am trying to upload the file on node form, I am getting the error "This value should be of the correct primitive type.".
Below is the widget form code in file mymmodule/Src/Plugin/Field/FieldWidget/CustomFieldWidget.php
Comment #16
antikapital CreditAttribution: antikapital commentedSame problem - 8.3.2
But, I have found an alternative, and it works:
https://www.drupal.org/project/votingapi_widgets
Comment #17
swastik1608 CreditAttribution: swastik1608 as a volunteer and at QED42 commentedThis has been fixed in the follow up issue link - https://www.drupal.org/node/2884270#comment-12118531.
Please review
Comment #18
swastik1608 CreditAttribution: swastik1608 as a volunteer and at QED42 commentedComment #19
gg24 CreditAttribution: gg24 as a volunteer and at QED42 commentedSeems https://www.drupal.org/node/2884270#comment-12118531 issue is a different issue for fivestar. We can handle this in separate one.
Above issue is still active.
Thanks!
Comment #20
Nil.Ned CreditAttribution: Nil.Ned commentedI've same problem but this patch doesn't works :-(
Comment #21
vgutekunst CreditAttribution: vgutekunst commentedSame problem here
Comment #22
BarisW CreditAttribution: BarisW at LimoenGroen commentedhttps://www.drupal.org/project/votingapi_widgets indeed is a great, working alternative! Thanks for the link @antikapital
Comment #23
maaty388 CreditAttribution: maaty388 commentedI'm changing status to active because this is still an issue and there is no fix yet.
Comment #24
Nil.Ned CreditAttribution: Nil.Ned commentedChanged solution to #22
Comment #25
maaty388 CreditAttribution: maaty388 commentedI'm changing priority to Critical because you cannot use this module. I just made fresh install of Drupal installed this module and when I want to save field it says "This value should be of the correct primitive type.", but if you choose default value error is gone, so this need to be fixed.
Comment #26
maaty388 CreditAttribution: maaty388 commentedI am debugging right now and I think so far the problem is default value should be set 0 instead of - or NULL not sure didn't fix it yet because if this is set to NULL validation fails... Hope it helps
Comment #27
Bala.addweb CreditAttribution: Bala.addweb at AddWeb Solution Pvt. Ltd. commentedIt is validation error for the default value field. I also get the same error but after giving some default value I save the field without an error. PFA screenshot.
Comment #28
DColo CreditAttribution: DColo commentedI tried changing the '-' to '0' in these files and it seems to work. The "correct primitive type" didn't happen when adding fields or saving content with the Fivestar field, and the Fivestar field also appears to now show up for items with no rating (might have to save them first).
Comment #29
nkoporecHave the same issue on latest drupal(8.4.5) and setting default value clears the issue.Also tried DColo solution and it works, but I think we need to create a patch with a more correct way to get rid of this issue...
Comment #30
maticb CreditAttribution: maticb commentedMade a patch according to #28, also fixed a related if clause in the JS code.
Comment #31
RumyanaRuseva CreditAttribution: RumyanaRuseva at FFW commentedThe patch looks and works ok.
Comment #32
init90Looks like the problem already fixed in current dev release of the module. Thanks, everyone!