allow an empty default setting in Flag Filter

aharown07 - May 21, 2009 - 04:15
Project:Flag
Version:6.x-1.1
Component:Views integration
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

the flags filter allows "Optional," which is great, but doesn't allow an empty default setting.... requires either True or False. Wd be nice to allow empty there.

#1

quicksketch - May 21, 2009 - 06:12

I don't understand the request here. In flag's database tables something "not flagged" (False) is the same as being empty.

#2

quicksketch - May 21, 2009 - 06:13

Also, see the handbook page on Listing content that is not flagged, if that's what you're looking for.

#3

aharown07 - May 21, 2009 - 13:34

I'm talking about the default setting for the filter. It's easy enough to find unflagged and flagged, but the flag filter does not currently allow the <any> setting as a default, as alot of other filters do. In our situation, a default that finds all flagged and unflagged makes more sense.

#4

quicksketch - May 21, 2009 - 19:16

I think the difference is caused by Flag's data storage. Flag does not store "1" and "0" for the status of a flag. Instead it just stores a row if the item has been flagged by a user and deletes a row if the user unflags an item. So having "True", "False", and "Any" doesn't make sense because "Any" is the same as True (the row exists in the database table).

#5

MickC - May 30, 2009 - 16:22

I'm using this workaround:

change $operator = $this->value ? 'IS NOT' : 'IS' ;
to $operator = $this->value ? 'IS NOT' : 'IS NOT NULL OR flag_content_node.uid IS' ;

Note that all this does is makes the False option an Any option, so you can default to False and ge everything in the view.
I figure if it's a binary option, then this is the lesser of two evils - in my case I don't need the 'not flagged' view, just 'flagged' or 'all'.

However a permanent solution would be nice - it would be good to be able to default to 'Any' as with most other filters.

#6

rjdempsey - June 15, 2009 - 17:16

I need to do the same. Where do you put this code?

#7

quicksketch - September 28, 2009 - 16:38
Status:active» fixed

This was fixed in #403602: Views Flagged Filter Option for Any.

#8

System Message - October 12, 2009 - 16:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.