Problem
When Flag is turned on an error appears when configuring contextual filters in Views, making it impossible to update the contextual filter configuration.
The config screen displays the message An illegal choice has been detected. Please contact the site administrator.
The on-site log says Illegal choice *relationship* in Flag element.
It seems that Flag tries to force the relationship to use a flag, even when there is none (or that relationship is not applicable).
Proposed resolution
See #2
Original report by skizzo
When I try to configure a node view's contextual filter (Content: Has taxonomy term ID, Specify validation criteria, Taxonomy Term) I get the following errors
- An illegal choice has been detected. Please contact the site administrator.
- log report: Illegal choice *relationship* in Flag element.
If I disable the Flag module then I can edit and save the View configuration without any problem. My flag configuration includes only a node-type flag, not global, applied to the same content type selected by the View.
Comment | File | Size | Author |
---|---|---|---|
#53 | issue_1484352_2.x_beta06.patch | 709 bytes | oxrc |
#20 | flag_plugin_argument_validate_flaggability.zip | 2.56 KB | kaztur |
#2 | 1484352-2-flag_validator_blocks_contextual_filters.patch | 709 bytes | Itangalo |
Comments
Comment #1
Itangalo CreditAttribution: Itangalo commentedConfirming this issue (and updating the title).
Bug also confirmed in latest dev version (as of April 2nd 2012).
Comment #2
Itangalo CreditAttribution: Itangalo commentedOk, attached is a patch that solves this for me.
It appears that the problem is not the relationships, but the argument validator. It introduces a select list in the validation options that can't be set when you don't have any flags relationships in the view. The default choice has the value
*relationship*
, and form API complains that this is not a valid choice.I think the patch solves the problem, but maybe it should be solved in a more robust way. (This feels like a work-around.)
Comment #2.0
Itangalo CreditAttribution: Itangalo commentedUpdated the issue with a 'proper' issue summary – with guidelines from http://drupal.org/node/1155816.
Comment #3
kaztur CreditAttribution: kaztur commentedSuch error. Unfortunately the patch didn't solved the trouble. Here is an export of view: http://kazan-doktor.ru/sites/default/files/my_view_with_flag_error.txt (sorry for russian in the file).
Comment #4
Matthew Davidson CreditAttribution: Matthew Davidson commentedI can't testify to the "Right"-ness of the solution, but the patch at #2 works for me.
Comment #5
citricguy CreditAttribution: citricguy commentedThe patch in #2 works for me as well.
Comment #6
noslokire CreditAttribution: noslokire commented#2 works for me
Comment #7
ohthehugemanatee CreditAttribution: ohthehugemanatee commentedpatch from #2 works for me, too.
Upping the priority to "critical", because breaking basic Views functionality is a pretty huge bug.
More than a month without anyone rewriting the patch... and it works for several people. I'd say it's a strong argument to have it committed to dev, even if only as a temporary solution.
Comment #8
dgastudio CreditAttribution: dgastudio commentedworks for me too.
Comment #9
nicholasyonko CreditAttribution: nicholasyonko commentedPatch works for me as well.
Comment #10
mansspams CreditAttribution: mansspams commentedComment #11
kaztur CreditAttribution: kaztur commentedUpd for #3:
Now #2 works for me too.
Sorry, seems to have mistook before adding the patch.
Great thanks, Itangalo!
Comment #12
Yusuf.Fidan CreditAttribution: Yusuf.Fidan commentedworks for me too.
Comment #13
Funksmaname CreditAttribution: Funksmaname commentedI didn't even know this problem was related to flags - found it from this issue: http://drupal.org/node/1559512
However, I can confirm that #2 fixed the problem for me!
Comment #14
hoporr CreditAttribution: hoporr commentedConfirming: patch in #2 fixes the problem.
Comment #15
mansspams CreditAttribution: mansspams commentedAfter applying patch #2 I noticed there is still some trouble removing flag relationship with Remove button from relationship overlay/modal. Removal only possible via rearrange overlay/modal.
Not sure if I should post it here or open new issue and how does it influence RTBC status.
Comment #16
Ignigena CreditAttribution: Ignigena commentedExperienced the same issue which caused Views to break completely and wouldn't allow creating contextual filters.
Patch #2 worked for me.
Comment #17
nagiek CreditAttribution: nagiek commentedMan, look at all the replies. Just goes to show how important Views is for all of us. :)
Any chance of a -dev release with this commit?
Comment #18
Babymaggie CreditAttribution: Babymaggie commentedThink this needs serious attention. Seems to be broke when I try to change any contextual filter on a bundled user relationships view as well.
So flag might not be the offender!
Hope this major bug is stamped out quick!
Comment #19
Babymaggie CreditAttribution: Babymaggie commentedCould someone please attach the file with the patch included for me as I am unsure how to apply patches.
This would be awesome - Thanks.
Comment #20
kaztur CreditAttribution: kaztur commentedFor Babymaggie patched file from the curremt last Flag version (7.x-2.0-beta6, no 7.x-2.x-dev)
Comment #21
Babymaggie CreditAttribution: Babymaggie commentedHi Kaztur, Awesome The patched file is working great! :)
Thanks a lot for the file and for the fast response.
Best wishes
Comment #22
Scott Ellis CreditAttribution: Scott Ellis commentedThank you. #2 / #20 worked for me too. Cheers.
Comment #23
mariusz.slonina CreditAttribution: mariusz.slonina commented#2. Thank You, Thank You, Thank You
Comment #24
-enzo- CreditAttribution: -enzo- commentedI had the same problem with a relation between feed and feed items, I have to uninstall flag module.
Comment #25
joshuautley CreditAttribution: joshuautley commentedI can confirm that with Drupal 7.14 and Flag 2.0-beta6 the patch provided in #2 works! (=
Good job Itangalo!
Comment #26
jenlamptonpatch in #2 works for me as well.
Comment #27
kitkat13 CreditAttribution: kitkat13 commentedI can confirm that with Drupal 7.14 and Flag 2.0-beta6 the patch provided in #2 works for me too
Comment #28
quinns CreditAttribution: quinns commentedConfirmed the patch in #2 works for us also.
Comment #29
jeff.maes CreditAttribution: jeff.maes commentedI confirm patch #2 works with Drupal 7.14 and Flag 2.0-beta6.
Seems to be worth releasing Flag 2.0-beta7 for this one since it blocks many views and there is no Flag 2.0-dev version available for downloading.
Comment #30
fraweg CreditAttribution: fraweg commentedConfirmed the patch in #2 an #20 works.
Thanks a lot!
Frank
Comment #31
quicksketchThanks guys, committed #2 to the 2.x branches.
Comment #32
joshuautley CreditAttribution: joshuautley commentedHurray! (=
Comment #33
petednz CreditAttribution: petednz commentedgood work guys - so this is only going to be available via git for a while or is there another release imminent?
Comment #34
quicksketchI'll hopefully make a new release shortly.
Comment #35
pipicom CreditAttribution: pipicom commented#2 definitely works..
Comment #36
maerys CreditAttribution: maerys commentedWorks for me as well. Thanks!
Comment #37
zhuber CreditAttribution: zhuber commented+1 for #2
Thanks @Itangalo
Comment #38
Alan D. CreditAttribution: Alan D. commentedJust resolved this locally before finding this thread. My solution was slightly different. Setting #access = FALSE also bypasses the error:
In saying that, I never saw the warning either of this sub-form component nor anything about Flags for that matter. So #2 looks like a better solution, unless this text is actually used somewhere...
Comment #39
caesar9171 CreditAttribution: caesar9171 commentedMy website is hosted by GoDaddy, and they don't give me full SSH access. I, therefore, cannot apply patches to anything on my drupal site. So far I have been able to avoid patching anything, but this Flag project issue with contextual filters in Views is preventing me from reaching the functionality level I would like.
So, does anybody have any suggestions about what I can do?
Maybe use kaztur's file in #20?
Or Alan D.'s solution in #38?
If it's one of these 2 solutions, could somebody please instruct me how to implement the solution?
I am pretty green when it comes to writing code.
Thanks for your time!
Comment #40
Alan D. CreditAttribution: Alan D. commentedUse the code from #2 - This is what was committed!
In the file "flag/includes/flag_plugin_argument_validate_flaggability.inc" (probably in sites/all/modules) find this code:
and replace with:
This adds all of those lines from the patch with the + to the file. If lines in the patch started with -, these would be deleted.
Good practice to backup a file from the server first, then FTP the modified one over the version that is on the server.
Comment #41
caesar9171 CreditAttribution: caesar9171 commentedIt seems to have worked! Thank you so much! I really appreciate it!
Comment #42
priapurnama CreditAttribution: priapurnama commentedPatch #2 also works for me, would someone update this already :\
Comment #43
Simon Georges CreditAttribution: Simon Georges commented@priapurnama, the fix has been committed and is available on 2.x-dev version of flag.
Comment #44
Yuri CreditAttribution: Yuri commented#43: 2.x-dev version of flag?? Where can I find that? I see only old releases on their project page
Comment #45
Alan D. CreditAttribution: Alan D. commentedhttp://drupal.org/node/887398 - DEV so use at your own risk.
Comment #46
ntigh52 CreditAttribution: ntigh52 commentedI have the same problem,
Why if it major bug report, there is no new release.
I dont know how to apply patch.
can anyone help me please?
Nathan (quicksketch) please release new ver.. ( there is a reason why not? )
Thanks a lot.
Comment #47
dgastudio CreditAttribution: dgastudio commentedhttp://ftp.drupal.org/files/projects/flag-7.x-2.x-dev.zip
Comment #48
ntigh52 CreditAttribution: ntigh52 commentedHi Alex ( kervi )
thanks a lot about the link, but why it is DEV and not a new release?!
When I choose to use dev It come with risk...
it is a major bug report.
Hope that will be new release s soon as possible.
Thanks
Comment #49
Itangalo CreditAttribution: Itangalo commentedntigh52: I think the reason is lack of time. Flag needs some more maintainers, to take care of the work that needs to be done. Most people maintaining Drupal projects do so on their spare time, and sometimes that time is just not enough.
Comment #50
ivars211 CreditAttribution: ivars211 commented#2 worked for me. This should be included in flag description.
Comment #51
sw3b CreditAttribution: sw3b commented#2 work for me too... thanks !
Comment #52
ntigh52 CreditAttribution: ntigh52 commentedThanks Johan Falk,
#2 is work but hopefully for new release...
Comment #53
oxrc CreditAttribution: oxrc commentedHere's the patch for the current 2.x_beta06 version in case someone needs it.
Comment #54
franzkewd CreditAttribution: franzkewd commentedThanks ffingers. Just what I was looking for.
Comment #55
tripper54 CreditAttribution: tripper54 commentedThanks Johan and ffingerz. #53 worked for me.
Comment #56
quicksketch@ntigh52 #1543826: Applicants Wanted: Flag Maintainership
Comment #57
sozonov CreditAttribution: sozonov commented#2 cool! thanks!
Comment #59
sk8erboi CreditAttribution: sk8erboi commented#2 Cool and Thumbs up! Worked for me!
Comment #60
royerd CreditAttribution: royerd commentedSame system message as many others, but my fix was even easier--I replaced the "Filter identifier" text with something other than what was showing as default.
Comment #61
SharonD214@aol.com CreditAttribution: SharonD214@aol.com commentedThanks! Works great!
Sharon
Comment #62
sajalsoni CreditAttribution: sajalsoni commented#2 worked for me. Thanks.
Comment #62.0
sajalsoni CreditAttribution: sajalsoni commentedrafamd, updated to reflect Itangalo's solution