What is the purpose of the "default" view?

dejamuse's picture

I've been learning and playing around with Views2 for a while now and have been wondering what use anyone would have for the default view other than the obvious.

The obvious: If you have a number of similar views you can save some time and work by inheriting most of the fields, filters, sorts, etc from a default view. Or you later make a change to one view that you want to propagate to other views without having to manually update each one.

Does it have a use beyond that? If so it's not at all obvious.

I'm willing to bet for the vast majority of users, the default view and the associated UI overhead and complexity of overriden values, is more of a nuisance than a help. In addition, anything in a group that is overriden makes all other items in that group overriden as well, so as soon as you do that a lot of the convenience of inheriting default values goes away (changes to other views that get saved to the default view cannot then be propagated to additional views). Most people have but a handful of views and manually building each one separately isn't that big a deal - it's done once and your finished.

So I would vote to either remove the default display altogether or at least allow the user to toggle its existence (along with the whole overriden overhead) on or off. Or maybe just replace the default concept with a clone concept since it's really done only once. That would get rid of the overriden complexity as well.



No. Try removing a leg from

merlinofchaos's picture

No. Try removing a leg from a chair because you don't like the leg. Same thing. I'm sorry you don't get it, but it's absolutely necessary, the architecture is built on top of it. It is not removable.

I kinda thought that might

dejamuse's picture

I kinda thought that might be the case.

Are you saying that the architecture inherently requires a default view or that's just the way it ended up because the default view was deemed a good idea from the outset?

Just curious. It's moot now obviously. You're not going to go back and rewrite the whole module just to change that!


Michelle's picture

I don't know whether or not the architecture always required it but I can say that it was a good idea at the outset and still is a good idea. This is a feature a lot of people use and love. You don't rip out powerful functionality just because a few people have trouble getting the hang of working it. Inheritance really isn't that difficult to understand if you just think about it a bit.


See my Drupal articles and tutorials or come check out the Coulee Region

It's not really a problem, I

dejamuse's picture

It's not really a problem, I did eventually get used to it, though a little tweaking of the UI would improve it a lot. I was mostly curious as to how others were using it to see if maybe there was something I was missing.

Every time I've built a view I ignored the default section entirely and just built the two or three other displays separately. Because of the all or nothing overriding issue, little gets carried over from default anyway.

I dunno, maybe others have a lot more very similar displays then I do.

But since it's an integral part of the architecture it's a moot point.

I would recommend changing

dafeder's picture

I would recommend changing your approach. If two displays share almost nothing, they don't belong in the same view, and you are of course going to have a headache keeping everything separate and organized. If you need two lists that have little in common, just build two different views. Define everything in the defaults. Instead of ignoring the default section, ignore the display section and let it inherit all the defaults.

No one is forcing you to use overrides, but it is a HUGE time saver to have the option if you have a site of any complexity.

Still a good idea

bonobo's picture

When creating a nodereference field, you can set up the default view -- and only the default view -- as your filter for the node reference.

You can also set up a single collection of fields in your default, and then -- using different arguments and filters -- display different sets of data to different users in different contexts.

The default view provides an incredible amount of flexibility.

And, if you still want to build out views individually (as opposed to multiple displays built atop one default) you can still do that. Although it's more work, and I don't know why anyone would want to...



Click. Connect. Learn.
Using Drupal in Education

dejamuse , just to add my

Matto's picture

dejamuse , just to add my two cents' worth to Bill's comments - I've only lately realised that the usefulness of a view is not always as a page, block or other form of display.

As Bill says, you can use a view to filter/finetune node reference and user reference selection options that are presented to users on node create/edit screens - that view (a default view) might never be displayed anywhere else as a page or block, etc, but it still has inherent value beyond its superset/inheritance value for one or more display versions.

Also - I haven't tried it yet - but I believe views in their default form also enable many operations on lists of nodes via the Views Bulk Operations module, e.g. "change the author of this list of nodes from admin to John Smith".

So, the default view concept exists for reasons other than inheritance. (But even if it did exist just for inheritance purposes it would certainly be "paying its way".)

  • Matto Rochford
    Drupal Content Consultant

I often use the default view

attheshow's picture

I often use the default view when I'm embedding a view into an existing template file. Here's my snippet for that:

print views_embed_view($name = 'NAME_OF_VIEW', $display_id = 'default', $node->nid);

Mark W. Jarrell
Manager of Web Services
Jones Knowledge Integration Group, Inc.
Twitter: attheshow

Mark W. Jarrell
Online Applications Developer
Richland Library
Twitter: attheshow

We use the default display constantly

modulist's picture

With the addition of displays, we often find ourselves creating quite a few related views where arguments wouldn't work well. The default display is a godsend to us on these complex sites.



I like being able to change

aeronox's picture

I like being able to change block and page views at the same time. I do this more often than I use override.

it seems to me

dpatte's picture

that the default view is an inconvenience until you understand that you can override each 'section' independantly as you need to. In most cases my subsequent views uaually have only have a minor change of arguments or fields. Now that I'm used to it, using the defaults its alot faster and more effiient than doing views separately.
For those that arent used to it, I have found that building views by node-type has become a convenience, and that my sort, relationships, and filters sections seldom change from what i set in the default when accessing a particular node. The only sections i tend to override are the fields and arguments.

tutorial for views

sticky2010's picture

Is there any good tutorials on all view types? ie how to create views. I have searched alot but can't seem to find any good one. Cheers.

GotDrupal has nice video tutorials

ppc.coder's picture

I like the videos from Got Drupal:

I like how he sounds pretty enthusiastic about what he's teaching.

Durran's picture

This is how much I like defaults...

This is meant as a "funny", but this sure would be cool eh?

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week