Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [views]

The Views module allows creating lists of content with a flexible query builder.

4
votes
5answers
447 views

How to stop a Views block from displaying to administrators, such as user/1?

I created a view and put an access role of anonymous user. When I log in with normal user account I don't see it, but when I log in with my admin account I see the view. I would like to not see it. ...
105
votes
3answers
65k views

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 ...
30
votes
5answers
29k views

Views and node count for taxonomy terms

How can I display the node count values for taxonomy terms in Views? with sorting the result list in descending order of node count.
15
votes
5answers
17k 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" ...
31
votes
9answers
43k 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 ...
24
votes
4answers
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 ...
19
votes
9answers
43k 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-...
13
votes
3answers
26k views

How to show the parent and child taxonomy term?

I have a vocabulary like this: Parent 1 Child 1 Child 2 Child 3 Parent 2 Child 1 Child 2 Now I would like to use a view to create a list of a Parent term with its Child terms. I try to do this ...
17
votes
1answer
25k views

Contextual filter with a block view

I have a page view("/news") with contextual filter for the topics ("news/design","news/coding"...) which are taxonomy terms and this worked fine. Due to some changes for the mobile theming, I need a ...
1
vote
1answer
293 views

How to show message view containing own and following activity?

I have created a message view using the Message module. I want this view to show the current user activity and activity of the user he is following using the "follow" flag (user). i.e own + following. ...
6
votes
5answers
4k views

Cannot edit my views.. I get a JSON string?

I'm using Drupal v7.22 and whenever I try to Modify the Display on views, and press the 'Add and configure' button on adding a field, or any button that sends data to the server, the page reloads and ...
8
votes
2answers
3k views

Show node IDs along with titles in Entity reference Autocomplete list

I'll like to add this functionality to the autocomplete widget in Entityreference field to show node ID next to the titles in the dropdown list. The reason behind the idea is to differentiate between ...
4
votes
2answers
3k views

Alter a Views query to use “OR” through the user interface

I have a view with a few different displays, each of them with slightly overridden filters, like this one used in a panel. How do you add this pseudocode via the UI? AND (node.type='story' OR node....
24
votes
5answers
14k 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 ...
7
votes
2answers
14k views

How do I get a block to use a URL to configure a contextual filter?

Blocks do not have paths so how can I pass a context to the block to get the correct results for a page? I am new and do not have enough reputation to answer my own question for eight hours (Go ...
5
votes
3answers
641 views

How to prevent access to Views-only content?

When I'm developing sites in Drupal, I create various content types and taxonomy vocabularies that I use with Views to build displays. I might not ever want the nodes to be viewable in their own right ...
4
votes
2answers
704 views

Selecting taxonomy term in article and showing all articles titles associated with this term

I have a content type article and when editing an article there should be a field where you can select a taxonomy term of a specific vocabulary. When viewing the article it should show a list of ...
0
votes
4answers
3k views

is it possible to have one views-view--VIEWNAME--page.tpl for multiple views?

I have 8 content types and 4 of them are the same and the difference is just their name. they all have a page view and the way I display them on screen is the same. instead of having 8 pages. (...
23
votes
4answers
10k 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 ...
19
votes
2answers
14k 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 ...
8
votes
3answers
16k views

What is the purpose of Views “Attachment”, “Content pane” & “Context”?

I've just made a Views for a content type. In one views, I need a page for the content type and a preview of 4 newest posts on the front page. Page is not the problem. For front page preview, I just ...
17
votes
3answers
21k 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?
3
votes
2answers
5k views

How to show the count of members that belong to a group?

I have a view showing a list of nodes of type group. How do I set it up to show the count of members that belong to each group?
8
votes
4answers
13k views

How to define Meta tags on Views? [closed]

Is there any module or some configuration that I can define the meta tags for the views page display in drupal 7 using Views 3.0?
8
votes
3answers
275 views

Is there a more performant alternative than overriding template files?

I've got to get rid of a lot of unnecessary markup in a view. In general, I accomplish that by overriding the template files in my theme, but this time the view is really huge and performance is going ...
4
votes
1answer
6k views

How to load and display a view with Ajax in Drupal 7?

This is the first time I've ever tried to load a view using Ajax in Drupal7 and I would be appreciated if you help me from scratch. I've spent hours to learn how to do this but I still failed! I ...
1
vote
1answer
310 views

How to show authorized users a link for relevant Views results using the Rules Link module?

Assume a list of entities, created by the Views module. For example a list of "All blocked/active users" which looks like so: User name Active Created date Last login Hillary.Trump No ...
18
votes
5answers
8k 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 ...
10
votes
4answers
6k views

How to configure an exposed filter in a view using a date picker?

How can I configure an exposed filter so that users can filter my site content by creation date, preferably using a date picker? I tried using Content: Authored on as filter, but it gets me a text ...
18
votes
6answers
7k views

View of users flagged by a user, users flagging a user, and nodes from users flagged by a user

I have a user flag that is pretty much like a "follow" or "subscribe" function. Basically I want to create 3 views for my website's user profile pages: A list of users flagged by a user (e.g. a ...
30
votes
3answers
35k views

Count results in Views using aggregation

Is it possible to count results (e.g. count the nodes of the content type x) in a view, using aggregation (not programmatically)?
22
votes
4answers
21k 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 ...
18
votes
4answers
7k views

How to combine views exposed filter with search?

My client asked me for a single field, that would work 2 ways: Autocomplete filter based on taxonomy. If site visitor inputs something that's not in taxonomy, full text search should be performed on ...
14
votes
2answers
3k 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 ...
10
votes
5answers
30k 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 ...
5
votes
2answers
13k views

Show all child nodes of a taxonomy term D7 [duplicate]

Ok, so I've been ripping my hair off for the past 2 days now. I'm developing a web-site with a car catalog which contains the following hierarchy (taxonomy hierarchy): -brand1 --model1 --model2 --...
6
votes
1answer
12k views

How to insert values into Global custom text field of views programmatically?

How can I programmatically insert values into Global custom text field from the views. I have tried using the $views variable from the hook_views_pre_render(&$views) and ...
4
votes
1answer
6k views

Get list of taxonomy terms for current node through Views

I've been trying this for awhile, and I keep finding answers that are close - but not quite. If there is a node with taxonomy terms attached to it, I want to create a block in Views that I can place ...
3
votes
4answers
8k views

Views with Entity Reference

I'm not sure why this is difficult for me to get. It seems like it should be simple. I have a content type A and content type B. Content type B has an entity reference field to content type A. ...
3
votes
4answers
11k views

views and contextual filters with entity reference field

how do you use contextual filters to a views block when you want to use a reference field from the content type displaying the view? here's the simple scenario artist content type has some basic ...
4
votes
4answers
5k views

Adding Theme Suggestions Programmatically For Views (Rows & Fields)

For a site I'm currently building I've got a variety of views, all with multiple display modes for different pages. For example, I have a venues view, one block is named listing which lists all of my ...
3
votes
2answers
3k views

How to count the node a user has created in a View?

I created a view to show Users. These users can create nodes of the "Questions" content type. The view has to render a table to show how many (the total number) Questions the user has created. ...
1
vote
1answer
610 views

How to make menu badges count disappear after the page is viewed?

With reference to my previous question which was a little confusing or I should say it was mixed up with two different problems. I am posting my question again with clarification. I have created a ...
36
votes
9answers
13k 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 ...
18
votes
4answers
12k 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 ...
20
votes
5answers
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 ...
11
votes
5answers
13k views

How to get each field value in views-views-unformatted--view-machine-name.html.twig?

I have an twig file: views-view-unformatted--view-machine-name.html.twig {# /** * @file * Default theme implementation to display a view of unformatted rows. * * Available variables: * - title: ...
10
votes
3answers
20k views

How to change programmatically exposed filters in views

I have a page view with exposed filters. One of the filters is term vocabulary, and that's dropdown list, user can select only one category (term). I want to set programmatically one term from ...
17
votes
3answers
26k views

How to pass Views contextual filter via URL?

I want to pass some values to my view via contextual filters in the URL. What GET naImes do I use? There seem to be no clue given, just this "The contextual filter values is provided by the URL". If ...
10
votes
5answers
17k views

hook_preprocess_page(): how to tell a views page?

Im writing a custom module that need to insert some javascript and css files only in a Views page. Im using hook_preprocess_page, but I can not tell if the current page is from a view: function ...