Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When select default value 1 out of 5. but when i cancel default selected value form backend its not cancel the rating it choose one star by default for more referance please see the attachment
Comment | File | Size | Author |
---|---|---|---|
#21 | interdiff_17-21.txt | 799 bytes | heddn |
#21 | 2899838-21.patch | 2.7 KB | heddn |
|
Comments
Comment #2
Sumit kumar CreditAttribution: Sumit kumar commentedComment #3
Sumit kumar CreditAttribution: Sumit kumar at Srijan | A Material+ Company for Srijan | A Material+ Company commentedComment #4
ShekharPaatni CreditAttribution: ShekharPaatni as a volunteer and commentedComment #5
gg24 CreditAttribution: gg24 as a volunteer and at QED42 commentedHi @ShekharPaatni,
I have tested this functionality and this works as expected.
Testing steps:-
But it is not working when I try to create a node and rate that node. Now if I try clicking on cross button either using node form or node view than it does not work.
Thanks!
Comment #6
gg24 CreditAttribution: gg24 as a volunteer and at QED42 commentedComment #7
pratik_kambleHi @ShekharPaatni and @gg24,
I have tested the functionality, it clears the stars on clicking cross button. But however on node view for page refresh, it does not reflect it.
Testing steps:
1. Added a field of type fivestar rating in a content type.
2. Selected a default value of stars in field settings.
3. Checked Allow users to cancel their ratings. checkbox and saved the field.
4. Edited the same field and clicked on cross button.
5. It clears the stars selected.
6. Added content with fivestar field. On node view after clicking the cross button it clears the stars but on refresh it is not getting reflected
Comment #8
ShekharPaatni CreditAttribution: ShekharPaatni as a volunteer and commentedHi @pratik_kamble and @gg24 ,
The issue of the cancel rating is done, now i am working with the functionality of the node rating.
Regards,
@ShekharPaatni
Comment #9
dbt102 CreditAttribution: dbt102 at Pineshore for Smoky Mountain Institute commentedThanks for you work on this @ShekharPaatni, @gg24 & @pratik_kamble ... looking forward to getting it committed
Comment #10
TR CreditAttribution: TR commented@ShekharPaatni Are you planning to finish the work on this?
Comment #11
Harlor CreditAttribution: Harlor commentedThis is certainly not an elegant solution but for me this works.
Comment #12
edysmplatest patch doesn't apply.
Comment #13
edysmprerolled patch.
Comment #14
TR CreditAttribution: TR commentedComment #15
heddnRe-rolled
Comment #16
TR CreditAttribution: TR commentedComment #17
heddnTest added
Comment #18
TR CreditAttribution: TR commentedHere's a patch with just the test from #17. This should fail, to confirm the problem and to confirm that the test is actually triggering the problem and verifying the fix.
Comment #20
TR CreditAttribution: TR commentedGood. That was as expected.
In this hunk:
Shouldn't the
if ($vote_rating !== 'cancel')
conditional also encompass the next code block starting with "Check to see if there is a target entity"? If we're canceling, we can skip that block as well. That was done in the original patch in #11.Also, shouldn't this be using
$form_state->hasValue('vote')
, which is a boolean instead of$form_state->getValue('vote')
, which could have an actual value of 0 and therefore evaluate to FALSE?Comment #21
heddnre #20:
Fixed first point.
Second point can't be changed because cancel actually passes along an empty value back and hasValue considers it to exist.
getValue
is actually the right thing. I tried playing around with it and tests failed when I changed to hasValue. Yeah tests.