Drupal Views: the difference between filters and arguments?

What is the difference between filters and arguments? For instance. if I need to show the nodes where event_start is inside the specified month, which should I use?

+4
source share
2 answers

The main difference is that the filters are fixed (if you do not open them, in which case they are explicitly configured by the user through forms), while the arguments are variables, usually taken from the URL (if you do not call the view from the code, in which if you can install them arbitrarily).

In your example, I think you are limited by filters, since you cannot specify a date range check with arguments (afaik). See this answer to a similar question regarding date ranges.

+4
source
  • Filters are used to limit the data that you receive. Fx receives nodes that are less than one week old, or which type is the page. Filters are static (unless you provide them to the most ordinary user you are searching for).
  • Arguments are usually used the same, but very different. They may or may not be present, and may come from various sources, such as a URL, some PHP code. Also, if the argument is missing, various actions can be taken.

What to use will depend on what you want. If you want to fx the event url /% of the month, and then display the events that occurred this month, you have to go for the arguments. But if you want to create a view showing all the events in December, you should use a filter instead.

0
source

All Articles