views can count on every field with the aggrgation setting.

Like this
View (Page) with filter for conrtent type task.
aggregation setting is ON
Just one field is added "is new" and count it.

Output is a simple number like "7"

I can create an menu entry for my view.
When I could assign my aggregated number to the menu entry, I have an dynamically number and a very flexible solution to count on every views field.

Comments

zengenuity’s picture

This is good idea, but I doubt I'll have time to add something like this soon.

Another similar (and perhaps more flexible idea) would be to create a new display type that allows you to create badges like you do pages, blocks, attachments, etc. That would probably be more useful, since you could use them everywhere instead of just on the same view where you define them.

Patches welcome if someone wants to take this on.

bennos’s picture

Better way in views.

We do not need the aggregation function.
Better and easier is to use the contextual filter. If the argument is not present, it provides a summary display like
New (1)
Active (7)
Work (2)

I think this needs only be themed.
I am not a views expert. Can use it very good, but not programming. Views is a beast.

Think about it. When you think it will work, I will sponsor the feature.

zengenuity’s picture

The system you have described would be very inflexible. It would only allow you to put menu badges on the exact same view with the same arguments. That's not what people usually want. For example, people often a list of 100 items, and they want a badge of 3 if there are 3 "new" or "pending" items in that list.

Here is what I propose instead:
1. I create a Menu Badge Views display type. So, the user would add a Menu Badge from the +Add button at the top of Views.
2. The user sets up this view any way they want. Having it return a number, using aggregation or otherwise, would make the most sense.
3. After saving, this menu badge is available system-wide using the existing interfaces for adding badges to menu items and tabs.

With a system like this, users could create badges for any query they could build with Views, and they could put those badges on any menu item they wanted. (even one that wasn't tied to Views) That would be the best approach, and it would allow you to accomplish your original goal.

If you are interested in sponsoring this, contact me through the contact form and we can discuss: http://drupal.org/user/326925/contact

bennos’s picture

yeah, you are right. Your solution is great.

zengenuity’s picture

Assigned: Unassigned » zengenuity

bennos has graciously sponsored this feature. It will be coming in about a week.

zengenuity’s picture

Version: 7.x-1.x-dev » 7.x-1.2
Status: Active » Fixed

Committed and released in version 7.x-1.2.

See this screencast for instructions on using Views to create menu badges: http://www.youtube.com/watch?v=4AoZQNg5QOI

rodrigoaguilera’s picture

this feature make this module awesome.

Thanks to both of you

bennos’s picture

no prob.
another cool module for drupal.

Status: Fixed » Closed (fixed)

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