I can't seem to find the answer anywhere, does the Views Module in Drupal 7 have an arguments component? If so how would I enable it?

Thanks

Comments

mradcliffe’s picture

Many of the advanced features of Views have been moved to an Advanced field set within the Views User Interface called "Contextual Filters".

blheng3d’s picture

I see. So the contextual filters works in the same way as arguments then? Thanks

tomcatuk’s picture

I'm having the same trouble. I want to add an argument to a view. I can't for the life of me see the benefit of calling an argument anything other than "argument". I had a pretty tough time teaching myself how to use Views in Drupal 6, and by renaming bitts of it I'm now having a tough time with 7 as I don't understand what anything is. Myabe it's just me.

blheng3d’s picture

Yeah I agree with you, I don't see any benefit of calling an argument other than "argument". Anyway, I searched endlessly on the web, unable to find anything regarding passing arguments in Drupal 7. I was looking for Node Reference tutorials and all seem to mention arguments to extend filters to a deeper level. Low and behold I was able to get the nodes reference working through contextual filters, thanks to mradcliffe.

mradcliffe’s picture

I agree. We have about four different definitions for the word "context" in contrib (context module, ctools contexts, views contextual filter, oauth context, and any other generic definition of context). It's terribly confusing not just for newcomers, but for veterans as well.

stevek123’s picture

It's extremely annoying because all tutorials refer to Arguments and they are nowhere to be seen in Drupal 7. It seems like they are making changes for the sake of making a change.

ptvv’s picture

It's not just the tutorials. The Entity Reference field editor has a space for "View arguments" which doesn't obviously correspond to anything in the View editor.

Ive’s picture

I agree.
Filter criteria can also be contextual. I don't see the logic behind the definitions.

Another thing that's bothering me in views is the settings of "Allow multiple values. "
quote:" If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND)."
In All search engines "+" is used for "AND"
When you want to filter content that fulfil all conditions it is more common to use 1+2+3.

And while I'm at it. Why is there no operator possible in arguments?

drupaluser_test’s picture

Hi,

I am using drupal 7. In my views block I have 100 contents. In that 100 contents I want to display only top 10 contents. I have to select that 10 contents. I can not add multiple nid in filter criteria. How can I add more than one nid in content:nid filter criteria?

Do you have any Idea?

maddcow’s picture

O.K. trying to configure date and calendar (D7 and all latest) and I got that arguments became contextual filters, however it is not displaying the fields created with views. If you follow the tutorial video on drupaltherapy (very good btw) you get to the point where you have to change the filter for the view however the newly created fields are not showing up. Can someone help point me in the right direction or is this a bug I need to report. I would assume that since I can't find a bug report on this that it's my lack of knowledge and not my spearheading into the unknown :-).

qudsiyya-1’s picture

I am having the same problem.

I am following the same tutorial and don't seem to find the user defined date fields in the list.

benjarlett’s picture

no idea.. would live to know.

qudsiyya-1’s picture

The following combination of modules solved my problem and I was able to view cck date field in the contexual filters.

Calender version = "7.x-2.x-dev"
Date version = "7.x-2.x-dev"
Ctools version = "7.x-1.0-alpha4"
Views version = "7.x-3.x-dev"

sylvaticus’s picture

As a d6 user, I had lot of troubles understaning what "arguments" were.
Now of course to me it would be better if it would have remained with such a name, but as a newcomer I think contextual filter is a more appropriate choise...

jorisx’s picture

this new contextual thing is not working...
ao how would I display a field in a block from the current node?

with arguments i would fix something like
-Node: Nid
-Provide default argument
-Node ID from URL

with that argument I would only get fields from the current node, but with contextual filter ?!

vaccinemedia’s picture

I am having similar problems... Using contextual filters I have selected Node ID and provided default value of content ID from URL. This way the only field which should display in my block should belong to the currently displayed node. It is also set up to hide the view if the filter value does not validate.

This works for when I'm viewing a node. If there is content in the field for the current node it is displayed. Great. If there is nothing in the field then nothing is displayed in the block. Good.

BUT when looking at a taxonomy page or a view, the block view instead displays every single occurrence of the field in question from every node. How can I make the view only display the content of the field when looking at a node which contains something in the field?

I'm a Drupal Website Developer and Google Street View Trusted Photographer.

vaccinemedia’s picture

This has now been fixed in Views 3.1 :)

I'm a Drupal Website Developer and Google Street View Trusted Photographer.

Anandyrh’s picture

I now have updated views to 3.1 but I don't see the Arguments option.

tillicum’s picture

Again, it's replaced with "Contextual filters" ! it does the same thing.

Anandyrh’s picture

Thank you...

goldhat’s picture

I have to agree that changing "Arguments" to "Contextual Filters" is at best pointless and at worst ridiculous. It certainly won't do much to dissuade naysayers who complain that Drupal is complexified and too difficult to learn. All we can do is write "in Drupal 7 View Arguments are now Contextual Filters" over and over again and hope that when people search for "where is views arguments in D7" they will quickly find the answer to that mystifying question.

WorldFallz’s picture

actually, 'contextual filter' is much more descriptive than 'argument' which users never seemed to understand in the first place. The reason it was renamed, was precisely because of all the posts and issues where users had no clue what 'argument' meant. Contrary to popular belief, maintainers and developers don't sit around trying to think of ways to confuse people, and make more work for themselves, just for the fun of it, lol.

Yes, the switch causes some temporary confusion for existing users, but that has to be balanced against the benefit of using an actual descriptive name that will likely be more beneficial to new users.

ericxb’s picture

I too have spent hours puzzling over just exactly the right name for a variable. The name has to be concise and yet still provide an instant mnemonic for it's purpose.

I have also suffered the pain of the loss of a name's perfection when the code has moved on to new features. A rose by any other name... [sniff]

"argument" is a very accurate label if the reader has experience writing code and understands what a function is. I'm grey-haired now and I usually slept thru English class; so words with 4 syllables intimidate me. But even with that impediment, a quick Google for "drupal views contextual filter" taught me what I needed to know. "contextual filter" is also an accurate label for the concept. In my own head, I use "parameter to insert into a SQL where clause;" but that's just me.

In the interest of broadening appeal, I'm not going to whine about a name change (Microsoft provides more than enough ranting material to keep me busy).

Rosco_Mole’s picture

I am afraid as "open Minded" as the Drupal community is, it suffers from the same thing as Lawyers and Doctors where things are INTENTIONALLY given confusing names, e.g. the whole Drupal 8 API will be in Latin!

While this tread discussed how changing the name to something is very confusing, changig it to a name which is already busy confusing others under 3 alias, why not a 4th? No one addressed the Arguments change, THEY are not the same! Views2.arguments != views3. contextual filters!!

This is a prime example of a growing and common perception (which I am agreeing with more and more), "Drupal is intentionally made difficult to learn and use as a barrier of entry, so that the top tier of Drupal developers have a HUGE advantage.

Thinking about Joomla / Wordpress more and more!

WorldFallz’s picture

THEY are not the same! Views2.arguments != views3. contextual filters!!

Yes. They. Are.

You might consider buying a clue before trolling without knowing what you're talking about, lol. Such a ridiculously incorrect, and easy to verify, assertion merely invalidates anything else you say.

But then you probably new that or you wouldn't have created an account just for this post ;-)