Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
111 votes
2 answers
68k views

Contextual filters taxonomy name

I'm adding a contextual filter to a view for a custom content type that has a taxonomy field. The contextual filter allows me to filter by the taxonomy tag id but not by the taxonomy tag name. Meaning ...
powers1's user avatar
  • 1,253
36 votes
9 answers
15k views

How to create a union of two views?

I'm trying to get a union of a user's nodes and comments sorted by "post date". This post links to sandbox projects for D6 but there is nothing for 7. This post has an example of using ...
uwe's user avatar
  • 12k
35 votes
4 answers
19k views

How do I change the ajax loading behaviour in Views?

I have a view with some exposed filters in a block; it uses AJAX and the auto-submit feature so the view is re-loaded as soon as a filter option is changed. In the short delay between selecting an ...
Clive's user avatar
  • 168k
34 votes
5 answers
33k views

Node count for taxonomy terms

How can I display the node count values for taxonomy terms with sorting the result list in descending order of node count?
ya.teck's user avatar
  • 5,692
34 votes
3 answers
22k views

How do I group elements in a view?

I have 8 articles: Article 1 (Gaming), Article 2 (Local News), Article 3 (World News), Article 4 (World News), Article 5 (Gaming), Article 6, Article 7, Article 8. In a view I would like to group the ...
mstef's user avatar
  • 441
33 votes
8 answers
51k views

How do I programmatically show a view block?

I created a view block, whose machine name is "news." How do I display it using module_invoke() and the machine name of the view?
vitaly.batonov's user avatar
31 votes
3 answers
43k views

Count results in Views using aggregation [closed]

Is it possible to count results (e.g. count the nodes of the content type x) in a view, using aggregation (not programmatically)?
hpn's user avatar
  • 2,398
31 votes
5 answers
22k views

How do I override a taxonomy/term/% list with a view?

I have a vocabulary attached to a content type. Only one term can be selected to categorize a node made with this content type. The vocabulary is called Vehicles and has terms 'cars, trucks, boats.' ...
blue928's user avatar
  • 3,814
30 votes
9 answers
45k views

How do I remove duplicates when using the random sort?

I have created a view where I am displaying the the node title and a logo (a cck field). In the arguments I have passed the taxonomy term name. In the result a node is displaying 2 or 3 times; I ...
Ahmad's user avatar
  • 2,845
29 votes
2 answers
21k views

What is the meaning of the field:delta content type offered in contextual filters in views?

When creating a new contextual filter for a view the list of types includes options such as content:spec (field_spec:delta) where spec is the name of a field I have attached to the content type ...
Ashlar's user avatar
  • 5,125
26 votes
5 answers
18k views

Expose single filter of combination of two fields in views

I have two user profile fields "Last Name" and "First Name". I also have a user list views. I want to expose "Name" as filter which can search for both Last Name and First Name. How can I do single ...
Sithu's user avatar
  • 4,963
23 votes
4 answers
11k views

Are views cached through the core caching mechanisms or should I be setting the caching directly in each view?

I see there are cache settings in each of my views. Do I need to set these or does the core caching mechanisms in /admin/config/development/performance automatically do some of this and these "extra ...
Nigel Waters's user avatar
  • 1,024
23 votes
5 answers
31k views

Get the actual query executed by a view

I need to find out the SQL query that is executed by a certain query. Views module can show the SQL when configuring the view but apparently the query is not the actual query that gets run in all ...
jjei's user avatar
  • 683
23 votes
4 answers
6k views

Clean way of building simple taxonomy browser of arbitrary depth

I have spent days trying to determine a clean way to do the following: Display a list of all top-level terms in a vocabulary with links to their child terms Upon clicking a link, be taken to a list ...
beth's user avatar
  • 9,087
22 votes
8 answers
18k views

How do I create a nested tree with terms & nodes with Views 3?

I need to create something similar like this: Colors (Vocabulary) Red (term) Dark (term) Node 1 Node 2 Light (term) Node 3 Node 4 Blue (term) Node 5 Node 6 Green (term) Node 7 Node 8 (...
iStryker's user avatar
  • 4,503
21 votes
2 answers
8k views

Custom views handler without table

This seemed easy at first but I'm losing my hair on this. I simply want to add a custom view handler that uses no table. I tried to do as views php proposed, $data['views']['mycustomfield'] in ...
Gregory Kapustin's user avatar
20 votes
3 answers
28k views

Filtering on node whose user ID is equal to the current user

In Drupal 6 you can have a filter node.uid = current user. How do you do this in Drupal 7?
george marcotte's user avatar
20 votes
5 answers
13k views

How do I use hook_views_query_alter()?

Following what reported in the documentation for hook_views_query_alter(), I created a file named alterform.views.inc and put it into an enabled module called alterform. I added the following code in ...
enjoylife's user avatar
  • 3,788
20 votes
2 answers
17k views

Using views with a custom table/schema

I need to set up some views that will pull some data from a custom table I created. Some views will need to pull content the regular way and from my custom table (where I may query for a particular ...
vintorg's user avatar
  • 1,993
19 votes
7 answers
34k views

Add FILTER CRITERIA in Views Programmatically

I want to add/modify a filter criteria programmatically. For example, for a view, I added an "Email Address" filter whose value is needed to change dynamically, it is needed to set to the current ...
Shafiul's user avatar
  • 1,226
19 votes
6 answers
28k views

How do I display/edit the machine name for a View?

How do I display/edit the machine name for a View? Reason for asking is that I tried cloning a view but the name I gave was rejected because it had already been used but I couldn't see where.
therobyouknow's user avatar
18 votes
9 answers
47k views

Create template file for views block

There is a lot about theming custom blocks, but what about blocks created by views? My views block has id: block-views-posts-listing-block, I try many ways for naming template file, ex: block--block-...
Codium's user avatar
  • 4,953
18 votes
2 answers
4k views

Views Block's machine name is being "hashed" (?)

A Drupal newbie, so correct me if my understand is wrong, but normally, when a Block is created by Views, the machine name of the block is appended to the Views' machine name. i.e. "...
Peter's user avatar
  • 691
18 votes
4 answers
13k views

How to use a views contextual filter OR?

After browsing the net and SE for a while it appears to me there is no good solution to combine 2 contextual filters with OR (rather than the default AND). This post mentions a PHP hack and this post ...
uwe's user avatar
  • 12k
18 votes
5 answers
9k views

How to Filter view by comparing 2 fields. If field-a < field-b

I have a product content type that has 2 price fields. I want to create a view that shows all products where price-A is less than price-B. I was hoping I could just add a filter and select price-A ...
Fadzy's user avatar
  • 181
17 votes
3 answers
29k views

Views exposed filter to search multiple fields [duplicate]

To my knowledge there hasn't been an option in drupal 7 to create a single exposed filter in a view which searches multiple fields, while in previous versions there existed modules to do just that. ...
J V's user avatar
  • 173
17 votes
9 answers
26k views

How can I create a view of child nodes based on the menu relationship?

Say you have the following pages in a menu tree: Projects Project One Project Two Project Three I'm looking for a way to create a view that will be embedded in the Project (parent) page that will ...
Camsoft's user avatar
  • 3,139
17 votes
1 answer
5k views

How to expose non Drupal tables in Views?

I wonder what is the best way to allow the Views module to access external tables not in Drupal? I tried the Data module, but it doesn't allow for a datetime datatype.
mcercado's user avatar
  • 171
16 votes
1 answer
13k views

How can I concatenate two fields in a view?

I have a view set up to use the unformatted list type. I'm pulling in about 10 different fields, but would like to concatenate two of them onto a single line in the display. Is this possible? Example:...
EmmyS's user avatar
  • 1,543
16 votes
3 answers
12k views

Views exposed filters without "Apply" button

I have created a view with exposed filters of term select list. How can I make the select list to work directly on selecting an item, instead of clicking on the "Apply" button?
AnAnD's user avatar
  • 616
16 votes
3 answers
20k views

Removing main content block on frontpage

I'm new to Drupal 7 and I'm looking to replace the frontpage's default main content block with an equivalent block generated from Views (gaining more control over the block in doing so). I have ...
irishbuzz's user avatar
  • 645
16 votes
1 answer
2k views

View commerce product image and price fields

In Drupal 7 commerce I ran into a problem. I want to display the latest 3 items placed in the show_product content type, with attributes from the store. There are several entities in the store, ...
JurgenR's user avatar
  • 2,183
15 votes
4 answers
28k views

How do I get the raw URL as a field in Views?

In views I need to return the raw url that is provided as the href value to the title field (when as a link) or the Content: link value. I thought originally I could choose Content:link and strip the ...
blue928's user avatar
  • 3,814
15 votes
1 answer
9k views

How to add Clear button for views exposed filter?

I created a content type and View with Filter Criteria for my project, when I click the Search it shows the appropriate results. But there is no option to clear the Search Fields and redirected to ...
Sam1604's user avatar
  • 299
15 votes
1 answer
26k views

Related nodes by taxonomy term in a view block [closed]

In Drupal 7, I've got a content type called "Asset" with a taxonomy field called "Category". All I need is a Block on the Asset pages that looks at the current node's Category term(s), finds all other ...
Sam's user avatar
  • 835
15 votes
2 answers
4k views

How do I set my views to return a 404 using Global: Null under contextual filters?

Standard Drupal behavior is to pass all arguments through, whether or not they requested. Sometimes this behavior is desired. However, I need to return a 404 for anything but a query string. Example ...
Nigel Waters's user avatar
  • 1,024
15 votes
4 answers
5k views

How do I filter only the root terms in a vocabulary in a view?

I have have a vocabulary structured as so: Root Alpha Term Alpha 1 Term Alpha 2 Subterm Alpha 1 Root Beta Root Gamma Term Gamma 1 Term Gamma 2 How do I filter the view to show only the root ...
Phizes's user avatar
  • 1,266
15 votes
1 answer
12k views

How to integrate Field collection module in Views?

I have created fields and grouped together with Field collection module. I have attached the group field (containing 4 fields), to user account settings in : admin/config/people/accounts/fields. Now ...
EKK's user avatar
  • 4,350
15 votes
1 answer
1k views

What is causing Views to consistently but intermittently not find a view provided by the Advanced Forum module?

I'm getting a frequent, intermittent error from the Advanced Forum module that causes a 500 error when it occurs (WSOD). On production, it's happening about 20 times per hour, on probably 2-3% of all ...
Justin's user avatar
  • 3,713
14 votes
3 answers
36k views

Using hook_form_alter on exposed view filters on Drupal 7

I'm having some trouble using hook_form_alter() with Views 3 and Drupal 7. I'm unable to add an if statement to uniquely identify a view; whatever I put in, the if statement is never found to be ...
SimonK's user avatar
  • 141
14 votes
3 answers
10k views

How to group views rows by year using date field?

I have a content type with a date field. I need to output them grouping by year, i.e. 2011 - nodeA 2011-09-01 - nodeB 2011-01-29 2010 - nodeC 2010-12-08 How can I do that?
Michał Pękała's user avatar
14 votes
2 answers
17k views

In a view, how can I link a field to the node?

In a fields view, the "title" field has a check box "Link this field to the original piece of content". But this check box isn't available for other fields. How can I achieve this functionality for ...
daphshez's user avatar
  • 1,082
14 votes
5 answers
44k views

how to use hook_views_query_alter() to modify where condition?

I'm trying to modify the where condition of a views query. till now I was successful with altering "order by", but I have no idea how to alter the where condition. I want to check the search_term and ...
nooshinha's user avatar
  • 418
14 votes
1 answer
8k views

What is the difference between rendered entity and content in views 3?

In the Format option for a view, the options include Content and Rendered Entity. They both offer you a selection of view mode for the content. The former includes some extra options on comments/...
artfulrobot's user avatar
  • 4,059
14 votes
5 answers
21k views

Changing url of exposed filter

When I used an exposed filter the filter selection is passed as name/value pair in the url, for example: members?field_a=valuea&field_b=valueb How can I set it up to use more of a "pathauto" ...
uwe's user avatar
  • 12k
13 votes
6 answers
6k views

How do I pass contextual filters to a view via services

I have a view that accepts a contextual filter in order to return the correct results. I'm using Services 3 and Drupal 7. I'm able to create an endpoint, and retrieve the view via services. But it ...
user379468's user avatar
  • 2,520
13 votes
5 answers
11k views

Is it possible to dynamically set Views' pager settings?

Say for instance, you have a view that displays when viewing a certain node type, but you want the pager settings to be different for each individual node. I was thinking of making a CCK field like "...
Jay's user avatar
  • 839
13 votes
5 answers
3k views

Building a Views Filter

I want to build a filter for a custom module I built and have integrated with views. In essence, the module allows you to define types of relationships between different nodes. I'd like to create a ...
lordg's user avatar
  • 705
13 votes
4 answers
2k views

Loading nodes from another Drupal database using Views

I'm trying to use Views to load nodes from another Drupal database defined in settings.php with a key of 'cms'. Both sites are Drupal 7. The other database is a different Drupal install which is ...
star-szr's user avatar
  • 2,705
12 votes
4 answers
17k views

drupal_goto(request_uri()) replaces my '?', '=' and '&' in url

I need to redirect user from a page with example.com/node/add/dispo?arg1=1&arg2=2 to the same type of URL. But when I simply do a drupal_goto(request_uri());, it redirects my user to example.com/...
Gregory Kapustin's user avatar

1
2 3 4 5
90